vcl/source/gdi/impglyphitem.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit b804a64bf78218b79e5e9ca2e99aa95bee60b430
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Mar 17 11:56:20 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Thu Mar 17 14:04:28 2022 +0100

    avoid warning about invalid cached glyphs
    
    Empty string has no glyphs, so SalLayoutGlyphs::IsValid() will be
    false and would trigger the warning at the beginning of
    OutputDevice::ImplLayout().
    
    Change-Id: I1be55679f27ba663570659f72c57e57e60f49a6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131700
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 37c535ab1e44..3853691d7d00 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -99,6 +99,8 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const 
OutputDevice> outputDevice, c
                                       sal_Int32 nIndex, sal_Int32 nLen, const 
Point& rLogicPos,
                                       tools::Long nLogicWidth) const
 {
+    if (nLen == 0)
+        return nullptr;
     const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, rLogicPos, 
nLogicWidth);
     auto it = mCachedGlyphs.find(key);
     if (it != mCachedGlyphs.end())

Reply via email to