diff options
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index eb3260bdbdc9..647788129d32 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -574,13 +574,18 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs) bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const { - int nCharCount = mnEndCharPos - mnMinCharPos; + const int nCharCount = mnEndCharPos - mnMinCharPos; for (int i = 0; i < nCharCount; ++i) pCharWidths[i] = 0; for (auto const& aGlyphItem : m_GlyphItems) - pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += aGlyphItem.mnNewWidth; + { + const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos; + if (nIndex >= nCharCount) + continue; + pCharWidths[nIndex] += aGlyphItem.mnNewWidth; + } return true; } |