summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-12-12 09:10:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-12-12 09:11:11 +0000
commit221a3413af1b0f86a78c141fb2ea8fe969911dfb (patch)
treec80c5b6bc88b458535e74347d90319b5c2563794 /svtools
parent3249009bb77933fe1c3402f5f2110048753c8a66 (diff)
coverity#1397056 Dereference null return value
Change-Id: Ieda3afdbdbcc8aa21f6584edc21738c4edb84000
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/treelistbox.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 230b90d931b4..67d8e95ea21a 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1844,12 +1844,15 @@ void SvTreeListBox::SetCheckButtonState( SvTreeListEntry* pEntry, SvButtonState
void SvTreeListBox::SetCheckButtonInvisible( SvTreeListEntry* pEntry)
{
- if( nTreeFlags & SvTreeFlags::CHKBTN )
- {
- SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
- pItem->SetStateInvisible();
- InvalidateEntry( pEntry );
- }
+ SvLBoxButton* pItem = (nTreeFlags & SvTreeFlags::CHKBTN) ?
+ static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button)) :
+ nullptr;
+
+ if (!pItem)
+ return;
+
+ pItem->SetStateInvisible();
+ InvalidateEntry(pEntry);
}
SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) const