ofz: Use-of-uninitialized-value

Change-Id: I87cfad2da9b90bc4487dc4deb2fda5bb31a6b763
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132888
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-04-12 08:45:23 +01:00
parent 3361db2179
commit 967717e65f

View file

@ -1779,7 +1779,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<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * aStr.getLength()]);
/*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() );