summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-09 17:34:00 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-09 20:38:34 +0100
commitb012d206350f57bf4268d8cd8528c32647c6b933 (patch)
treea63a014c04e1c48d29bd8a62a94b12774ca1ef1a /sc
parent47b4b1633a08dd4c97d66feabe8cd3290074dc0f (diff)
cid#1636669 Dereference after null check
Change-Id: I56e9669058a79750f83bb99e682e25c3fea2a0bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178170 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx54
1 files changed, 28 insertions, 26 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 246a7fe8e3a1..e41e3ece60c4 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -5261,36 +5261,38 @@ void ScXMLExport::GetChangeTrackViewSettings(ScDocument& rDoc, uno::Sequence<bea
void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
{
- if (GetModel().is())
+ if (!GetModel().is())
+ return;
+
+ ScModelObj* pDocObj(comphelper::getFromUnoTunnel<ScModelObj>( GetModel() ));
+ if (!pDocObj)
+ return;
+
+ SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
+ if (pEmbeddedObj)
{
rProps.realloc(4);
beans::PropertyValue* pProps(rProps.getArray());
- ScModelObj* pDocObj(comphelper::getFromUnoTunnel<ScModelObj>( GetModel() ));
- if (pDocObj)
- {
- SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
- if (pEmbeddedObj)
- {
- tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
- sal_uInt16 i(0);
- pProps[i].Name = "VisibleAreaTop";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.Top());
- pProps[++i].Name = "VisibleAreaLeft";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.Left());
- pProps[++i].Name = "VisibleAreaWidth";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenWidth());
- pProps[++i].Name = "VisibleAreaHeight";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenHeight());
- }
- }
- ScDocument* pDoc = pDocObj->GetDocument();
- if (!pDoc)
- {
- SAL_WARN("sc", "no ScDocument!");
- return;
- }
- GetChangeTrackViewSettings(*pDoc, rProps);
+
+ tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
+ sal_uInt16 i(0);
+ pProps[i].Name = "VisibleAreaTop";
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.Top());
+ pProps[++i].Name = "VisibleAreaLeft";
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.Left());
+ pProps[++i].Name = "VisibleAreaWidth";
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenWidth());
+ pProps[++i].Name = "VisibleAreaHeight";
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenHeight());
+ }
+
+ ScDocument* pDoc = pDocObj->GetDocument();
+ if (!pDoc)
+ {
+ SAL_WARN("sc", "no ScDocument!");
+ return;
}
+ GetChangeTrackViewSettings(*pDoc, rProps);
}
void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)