summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2022-12-15 18:32:59 +0000
committerAndras Timar <andras.timar@collabora.com>2022-12-20 20:47:14 +0000
commit3d3f15040c7ed4f8d8e3fedf93b5042ae15b70c7 (patch)
treeabef6ef336fe40bef4485ccf0d12a9a10f583880 /sc
parenta718875215ee8747fcad32a70c7ccf9a273b3880 (diff)
lok: protect sc from null ScViewData.
Working hypothesis is this happens after a failed spreadsheet load, or from a race during load. <crash> ScModelObj::getPartInfo(int) sc/source/ui/unoobj/docuno.cxx:602 doc_getPartInfo desktop/source/lib/init.cxx:3531 ... KitSocketPoll::kitPoll(int) coolforkit SvpSalInstance::DoYield(bool, bool) vcl/headless/svpinst.cxx:492 Change-Id: I06870336d4e64ebfc69bce64e280821c25e1b1e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144251 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4b6d5ff3a2a9..1b3c53213d3e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -572,7 +572,10 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
void ScModelObj::setPart( int nPart, bool /*bAllowChangeFocus*/ )
{
ScViewData* pViewData = ScDocShell::GetViewData();
- ScTabView* pTabView = pViewData->GetView();
+ ScTabView* pTabView = nullptr;
+
+ if (pViewData)
+ pTabView = pViewData->GetView();
if (pTabView)
{
@@ -599,6 +602,8 @@ int ScModelObj::getPart()
OUString ScModelObj::getPartInfo( int nPart )
{
ScViewData* pViewData = ScDocShell::GetViewData();
+ if (!pViewData)
+ return OUString();
const bool bIsVisible = pViewData->GetDocument().IsVisible(nPart);
//FIXME: Implement IsSelected().
const bool bIsSelected = false; //pViewData->GetDocument()->IsSelected(nPart);
@@ -618,6 +623,8 @@ OUString ScModelObj::getPartName( int nPart )
{
OUString sTabName;
ScViewData* pViewData = ScDocShell::GetViewData();
+ if (!pViewData)
+ return OUString();
pViewData->GetDocument().GetName(nPart, sTabName);
return sTabName;
}
@@ -626,6 +633,8 @@ OUString ScModelObj::getPartHash( int nPart )
{
sal_Int64 nHashCode;
ScViewData* pViewData = ScDocShell::GetViewData();
+ if (!pViewData)
+ return OUString();
return (pViewData->GetDocument().GetHashCode(nPart, nHashCode) ? OUString::number(nHashCode) : OUString());
}