From 221a3413af1b0f86a78c141fb2ea8fe969911dfb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 12 Dec 2016 09:10:39 +0000 Subject: coverity#1397056 Dereference null return value Change-Id: Ieda3afdbdbcc8aa21f6584edc21738c4edb84000 --- svtools/source/contnr/treelistbox.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'svtools') 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(pEntry->GetFirstItem(SvLBoxItemType::Button)); - pItem->SetStateInvisible(); - InvalidateEntry( pEntry ); - } + SvLBoxButton* pItem = (nTreeFlags & SvTreeFlags::CHKBTN) ? + static_cast(pEntry->GetFirstItem(SvLBoxItemType::Button)) : + nullptr; + + if (!pItem) + return; + + pItem->SetStateInvisible(); + InvalidateEntry(pEntry); } SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) const -- cgit