From 7b52b96a6f742952d7b4c57a60aee494a2e25cde Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 28 Jan 2014 09:39:30 +0000 Subject: coverity#440874 Dereference before null check Change-Id: I542da40fe1209198ea784cf52372cd6d83292f33 --- toolkit/source/awt/vclxmenu.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index ab25dfdf518a..400b10b98860 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -365,8 +365,11 @@ throw(css::uno::RuntimeException) SolarMutexGuard aSolarGuard; ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + if (!mpMenu) + return; + sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount(); - if ( mpMenu && ( nCount > 0 ) && ( nPos >= 0 ) && ( nPos < nItemCount ) && ( nItemCount > 0 )) + if ( ( nCount > 0 ) && ( nPos >= 0 ) && ( nPos < nItemCount ) && ( nItemCount > 0 )) { sal_Int16 nP = sal::static_int_cast< sal_Int16 >( std::min( (int)(nPos+nCount), (int)nItemCount )); -- cgit