summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-02-19 13:44:25 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-02-19 20:48:59 +0100
commitc1d94ca2cf558c38f62b9893bc3e9cba56a1a1a7 (patch)
tree8fe1c57d2ea40453c7893b9a2551d8bf91509659
parent38642dafb6dd4aed75d70a9409f104c856802e7b (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/treelist/treelistbox.cxx6
1 files changed, 4 insertions, 2 deletions
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);
}