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>
This commit is contained in:
Caolán McNamara 2024-12-09 17:34:00 +00:00
parent 47b4b1633a
commit b012d20635

View file

@ -5261,36 +5261,38 @@ void ScXMLExport::GetChangeTrackViewSettings(ScDocument& rDoc, uno::Sequence<bea
void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps) 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); rProps.realloc(4);
beans::PropertyValue* pProps(rProps.getArray()); beans::PropertyValue* pProps(rProps.getArray());
ScModelObj* pDocObj(comphelper::getFromUnoTunnel<ScModelObj>( GetModel() ));
if (pDocObj) tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
{ sal_uInt16 i(0);
SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject(); pProps[i].Name = "VisibleAreaTop";
if (pEmbeddedObj) pProps[i].Value <<= static_cast<sal_Int32>(aRect.Top());
{ pProps[++i].Name = "VisibleAreaLeft";
tools::Rectangle aRect(pEmbeddedObj->GetVisArea()); pProps[i].Value <<= static_cast<sal_Int32>(aRect.Left());
sal_uInt16 i(0); pProps[++i].Name = "VisibleAreaWidth";
pProps[i].Name = "VisibleAreaTop"; pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenWidth());
pProps[i].Value <<= static_cast<sal_Int32>(aRect.Top()); pProps[++i].Name = "VisibleAreaHeight";
pProps[++i].Name = "VisibleAreaLeft"; pProps[i].Value <<= static_cast<sal_Int32>(aRect.getOpenHeight());
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);
} }
ScDocument* pDoc = pDocObj->GetDocument();
if (!pDoc)
{
SAL_WARN("sc", "no ScDocument!");
return;
}
GetChangeTrackViewSettings(*pDoc, rProps);
} }
void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps) void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)