diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2022-12-15 18:32:59 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2022-12-16 16:55:21 +0000 |
commit | 39ffd246450cbf5feb68d7f5ab058b92a951066a (patch) | |
tree | 451c0b1b8cbe9577cfad3b7b47e5d85cd01beed5 /sc | |
parent | d792eb7ba7b1b65964a950fd7b309b40ae8b8ad5 (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/+/144308
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index d3cbd98af592..9072d2824ce4 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -568,7 +568,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) { @@ -595,6 +598,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); @@ -614,6 +619,8 @@ OUString ScModelObj::getPartName( int nPart ) { OUString sTabName; ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + return OUString(); pViewData->GetDocument().GetName(nPart, sTabName); return sTabName; } @@ -622,6 +629,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()); } |