From 8b7dfd32f417652087e3d880bcbf88bc2b4d2676 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Sat, 18 Jan 2025 10:04:33 +0100 Subject: vcl: Dereferencing NULL pointer 'pData' After commit a108fce773d46441e30dcc14abe29751410ae4ed Author: Michael Weghorn Date: Fri Jan 17 14:18:30 2025 +0100 tdf#163186 qt: Show menu item tooltips C: /cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win_analyze/vcl/source/window/menu.cxx(1144): error C2220: the following warning is treated as an error C: \cygwin\home\tdf\lode\jenkins\workspace\lo_tb_master_win_analyze\vcl\source\window\menu.cxx(1142) : warning C6011: Dereferencing NULL pointer 'pData'. : Lines: 1137, 1139, 1142 Change-Id: I62e8462fcff83817f876489a10bd010e246a1d01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180430 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index f7032281f7b2..75936aed46ca 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1137,10 +1137,12 @@ void Menu::SetTipHelpText( sal_uInt16 nItemId, const OUString& rStr ) MenuItemData* pData = pItemList->GetData( nItemId ); if ( pData ) + { pData->aTipHelpText = rStr; - if (ImplGetSalMenu() && pData->pSalMenuItem) - ImplGetSalMenu()->SetItemTooltip(pData->pSalMenuItem.get(), rStr); + if (ImplGetSalMenu() && pData->pSalMenuItem) + ImplGetSalMenu()->SetItemTooltip(pData->pSalMenuItem.get(), rStr); + } } OUString Menu::GetTipHelpText( sal_uInt16 nItemId ) const -- cgit