sc/source/ui/view/tabvwsha.cxx | 4 ++-- sd/source/ui/docshell/docshel3.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
New commits: commit b07230384c51b99f8e98737afef6d0df908c240f Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Apr 8 06:42:58 2025 +0000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Wed Apr 9 09:04:52 2025 +0200 Fix potentially uninitialized local pointer variable Change-Id: Iaa7619491c1462303f4df82c1cb12f23409c4986 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183833 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 34f7d41a7038..e00d8f39a385 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -810,10 +810,10 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq ) // only SID_SAVEDOC / SID_SAVEASDOC bool bCommitChanges = true; const SfxItemSet* pReqArgs = rReq.GetArgs(); - const SfxPoolItem* pItem; + const SfxPoolItem* pItem = nullptr; bool bHasDontTerminateEdit = pReqArgs && pReqArgs->HasItem(FN_PARAM_1, &pItem); - if (bHasDontTerminateEdit) + if (bHasDontTerminateEdit && pItem) bCommitChanges = !static_cast<const SfxBoolItem*>(pItem)->GetValue(); // Finish entering unless 'DontTerminateEdit' is specified, even if a formula is being processed diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 92f17dcaf414..d473087c5fb2 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -234,11 +234,11 @@ void DrawDocShell::Execute( SfxRequest& rReq ) case SID_SAVEDOC: case SID_SAVEASDOC: { - const SfxPoolItem* pItem; + const SfxPoolItem* pItem = nullptr; bool bCommitChanges = false; const SfxItemSet* pReqArgs = rReq.GetArgs(); bool bHasDontTerminateEdit = pReqArgs && pReqArgs->HasItem(FN_PARAM_1, &pItem); - if (bHasDontTerminateEdit) + if (bHasDontTerminateEdit && pItem) bCommitChanges = !static_cast<const SfxBoolItem*>(pItem)->GetValue(); if (mpViewShell && bCommitChanges)