summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-12 08:45:23 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-04-12 11:57:24 +0200
commit6204b213d478d99ff556b2b270af3151da1ac357 (patch)
tree428683a7ad2b57d3bdba9fe35a2e5b3d84adecce
parent67851564d74bc8108e4802abfeb4fb88f4adf71d (diff)
ofz: Use-of-uninitialized-value
Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132857 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--vcl/source/outdev/text.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 9de93b342c53..0c73a4d347fd 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1678,7 +1678,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta
tools::Long nMnemonicX = 0;
tools::Long nMnemonicY = 0;
DeviceCoordinate nMnemonicWidth = 0;
- if ( nMnemonicPos != -1 )
+ if (nMnemonicPos != -1 && nMnemonicPos < aStr.getLength())
{
std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * aStr.getLength()]);
/*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() );