comphelper/source/misc/accessibletexthelper.cxx |    5 ++---
 include/vcl/toolkit/treelistbox.hxx             |    2 ++
 svx/source/tbxctrls/fontworkgallery.cxx         |    2 +-
 vcl/source/treelist/treelistbox.cxx             |    7 +++++++
 vcl/source/treelist/uiobject.cxx                |    4 +++-
 5 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 5adc90960a84c738e04a8508e5d9b179e757dd0e
Author:     Mike Kaganski <[email protected]>
AuthorDate: Fri May 6 15:01:59 2022 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Jun 5 07:51:47 2022 +0200

    Only dereference iterators after checking them
    
    Was this way since commit edf11d28fafac50b6380c9372d0e6cf07a355616
      Author Vladimir Glazounov <[email protected]>
      Date   Thu Apr 24 16:27:52 2003 +0000
        INTEGRATION: CWS uaa02 (1.3.44); FILE MERGED
    
    Surfaced after commit b1148c31ed2786396f0b018a988fce8288f1797d
      Author Noel Grandin <[email protected]>
      Date   Wed Apr 27 16:47:53 2022 +0200
        use more string_view in comphelper
    
    where the pointers were changed to iterators, which are checked in
    debug builds, failing an assertion.
    
    Change-Id: I87fce562aef8f50b94fb52ad6c2a79d2e84d6424
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133934
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135407
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/comphelper/source/misc/accessibletexthelper.cxx 
b/comphelper/source/misc/accessibletexthelper.cxx
index 35fe769c1700..6bb244dd5b1a 100644
--- a/comphelper/source/misc/accessibletexthelper.cxx
+++ b/comphelper/source/misc/accessibletexthelper.cxx
@@ -682,9 +682,8 @@ namespace comphelper
         const sal_Unicode* pLastDiffNew  = rNewString.getStr() + nLenNew;
 
         // find first difference
-        while ((*pFirstDiffOld == *pFirstDiffNew) &&
-               (pFirstDiffOld  <  pLastDiffOld) &&
-               (pFirstDiffNew  <  pLastDiffNew))
+        while ((pFirstDiffOld < pLastDiffOld) && (pFirstDiffNew < pLastDiffNew)
+               && (*pFirstDiffOld == *pFirstDiffNew))
         {
             pFirstDiffOld++;
             pFirstDiffNew++;
commit 273eb41f28eded48ff27561ae28882658b5099ad
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue May 3 09:49:07 2022 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Jun 5 07:51:32 2022 +0200

    Don't add empty labels to fontwork's icon view
    
    This allows to center the icon in the respective entry,
    not having whitespace in the bottom
    
    Change-Id: Ib148df6911f020f8d4efca4f6a80a65b7f95945f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133720
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135406
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 999f3a52c6b6..ff1cc54216e8 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -565,6 +565,8 @@ public:
     void            SetCheckButtonState( SvTreeListEntry*, SvButtonState );
     SvButtonState   GetCheckButtonState( SvTreeListEntry* ) const;
 
+    static bool     HasEntryText(const SvTreeListEntry* pEntry);
+
     void            SetEntryText(SvTreeListEntry*, const OUString& );
     void            SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const 
Image& _rImage );
     void            SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const 
Image& _rImage );
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx 
b/svx/source/tbxctrls/fontworkgallery.cxx
index de42c5f639c4..3cc8e5ac381a 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -131,7 +131,7 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 
nThemeId)
     for( size_t nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
     {
         OUString sId = OUString::number(static_cast<sal_uInt16>(nFavorite));
-        maCtlFavorites->append(sId, "", maFavoritesHorizontal[nFavorite-1]);
+        maCtlFavorites->insert(-1, nullptr, &sId, 
maFavoritesHorizontal[nFavorite - 1], nullptr);
     }
 
     if (maCtlFavorites->n_children())
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index f8cfaaf6a311..f2ec419891be 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1572,6 +1572,13 @@ SvTreeListEntry* SvTreeListBox::InsertEntry(
     return pEntry;
 }
 
+// static
+bool SvTreeListBox::HasEntryText(const SvTreeListEntry* pEntry)
+{
+    assert(pEntry);
+    return pEntry->GetFirstItem(SvLBoxItemType::String) != nullptr;
+}
+
 void SvTreeListBox::SetEntryText(SvTreeListEntry* pEntry, const OUString& rStr)
 {
     SvLBoxString* pItem = 
static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String));
diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx
index 0caea7163f76..846cc2066f46 100644
--- a/vcl/source/treelist/uiobject.cxx
+++ b/vcl/source/treelist/uiobject.cxx
@@ -38,7 +38,9 @@ StringMap TreeListUIObject::get_state()
     aMap["LevelChildren"] = 
OUString::number(mxTreeList->GetLevelChildCount(nullptr));
     aMap["CheckBoxList"] = OUString::boolean(isCheckBoxList(mxTreeList));
     SvTreeListEntry* pEntry = mxTreeList->FirstSelected();
-    aMap["SelectEntryText"] = pEntry ? mxTreeList->GetEntryText(pEntry) : 
OUString();
+    aMap["SelectEntryText"] = (pEntry && SvTreeListBox::HasEntryText(pEntry))
+                                  ? mxTreeList->GetEntryText(pEntry)
+                                  : OUString();
 
     return aMap;
 }

Reply via email to