summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-05-02 21:17:06 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-09-22 20:18:06 +0200
commite7deb919703eab1ea18ad9d7704fd5d5993cf445 (patch)
treef425271c6e47f452a3b22fd47f89d18aa4028ab7 /vcl
parent132c8d410e57b48d1910159b47453a157aacb4cb (diff)
ofz: Use-of-uninitialized-value
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133717 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit f248b99b6f7f93b5170b4c50d7827fa0dd23421e) Change-Id: I9ca24a135494a49449aec63615b2d945a93e8b27
Diffstat (limited to 'vcl')
-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 0bb1d36fd35e..cea6f18410d1 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1079,7 +1079,7 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, long* pCaretXArray,
for( i = 0; i < 2 * nLen; ++i )
if( pCaretXArray[ i ] >= 0 )
break;
- long nXPos = pCaretXArray[ i ];
+ long nXPos = (i < 2 * nLen) ? pCaretXArray[i] : -1;
for( i = 0; i < 2 * nLen; ++i )
{
if( pCaretXArray[ i ] >= 0 )