summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-06 14:34:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-03-06 16:40:32 +0100
commitbe364e3c211b74899b9e0007ce22e8ef659d003d (patch)
treea06fced33e6519e0e4274d9528300eaf30f952e4
parent08bbd27e1cb6106e48489b2ca787201ca88da74a (diff)
ofz: Use-of-uninitialized-value
Change-Id: I1f1771c384e88417f40ea9dd76378fb057e3d977 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131075 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/outdev/text.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3d773e56d488..b929fb294cd8 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1080,7 +1080,10 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXAr
std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, Point(0, 0), 0, {},
eDefaultLayout, nullptr, pGlyphs);
if( !pSalLayout )
+ {
+ std::fill(pCaretXArray, pCaretXArray + nLen * 2, -1);
return;
+ }
int nWidthFactor = pSalLayout->GetUnitsPerPixel();
pSalLayout->GetCaretPositions( 2*nLen, pCaretXArray );