From 0ac3a94c9f7bffe27ec1e07c4cc73cf2425b3898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 13 May 2014 20:39:53 +0100 Subject: [PATCH] coverity#440876 Dereference null return value Change-Id: I7d00c3a3c1a12176e4b1ab74712aabeb2f1cf90e --- framework/source/uielement/toolbarsmenucontroller.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index a90b59790a78..cca476f6796d 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -556,7 +556,11 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev { SolarMutexGuard aGuard; VCLXPopupMenu* pXPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( xPopupMenu ); - PopupMenu* pVCLPopupMenu = (PopupMenu *)pXPopupMenu->GetMenu(); + PopupMenu* pVCLPopupMenu = pXPopupMenu ? (PopupMenu *)pXPopupMenu->GetMenu() : NULL; + + assert(pVCLPopupMenu); + if (!pVCLPopupMenu) + return; for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ ) {