[Libreoffice-commits] core.git: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 19 19:49:23 UTC 2019


 vcl/source/treelist/treelistbox.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c1d94ca2cf558c38f62b9893bc3e9cba56a1a1a7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Feb 19 13:44:25 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 19 20:48:59 2019 +0100

    survive sorting when a row may not have any string in it yet
    
    Change-Id: Idbea259266da817803ebb3d2f36ca0c0fca9bf3b
    Reviewed-on: https://gerrit.libreoffice.org/68019
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index aa91551177d8..e306d7df0e47 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3316,8 +3316,10 @@ IMPL_LINK( SvTreeListBox, DefaultCompare, const SvSortData&, rData, sal_Int32 )
 {
     const SvTreeListEntry* pLeft = rData.pLeft;
     const SvTreeListEntry* pRight = rData.pRight;
-    OUString aLeft( static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String))->GetText());
-    OUString aRight( static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String))->GetText());
+    const SvLBoxString* pLeftText = static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String));
+    const SvLBoxString* pRightText = static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String));
+    OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
+    OUString aRight = pRightText ? pRightText->GetText() : OUString();
     pImpl->UpdateStringSorter();
     return pImpl->m_pStringSorter->compare(aLeft, aRight);
 }


More information about the Libreoffice-commits mailing list