summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/docsh5.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-12 12:52:14 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-12 17:21:40 +0200
commit034eb5078096d146fb5c5e6246a407f2aad09094 (patch)
treeb0f5f649183f6e1150709b2f2c07a39196560b74 /sc/source/ui/docshell/docsh5.cxx
parent512e28bf8d10f9246df2d535f92c1ccef1628192 (diff)
help msvc -analyzer out wrt C6011 Dereferencing NULL pointer
Change-Id: Ied22e4ea805ab5a94f89a71438962bdd6d118771 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167548 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/docshell/docsh5.cxx')
-rw-r--r--sc/source/ui/docshell/docsh5.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 63bb94408eba..1b2ddf216b9f 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -508,6 +508,13 @@ static OUString lcl_GetAreaName( ScDocument* pDoc, const ScArea* pArea )
return aName;
}
+static ScDBData* getUndoData(ScDBData* pDestData)
+{
+ if (!pDestData)
+ return nullptr;
+ return new ScDBData(*pDestData);
+}
+
void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
{
ScConsData aData;
@@ -568,7 +575,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
aData.GetSize( nColSize, nRowSize );
if (bRecord && nColSize > 0 && nRowSize > 0)
{
- std::unique_ptr<ScDBData> pUndoData(pDestData ? new ScDBData(*pDestData) : nullptr);
+ std::unique_ptr<ScDBData> pUndoData(getUndoData(pDestData));
SCTAB nDestTab = rParam.nTab;
ScArea aDestArea( rParam.nTab, rParam.nCol, rParam.nRow,