sc/source/ui/unoobj/docuno.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 97ad52082df46e665293c21621eab2f147db41d6 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu Dec 15 18:32:59 2022 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Dec 19 11:55:17 2022 +0000 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.me...@collabora.com> (cherry picked from commit 39ffd246450cbf5feb68d7f5ab058b92a951066a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144433 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 46933719e135..f030ff8b484f 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -571,7 +571,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) { @@ -598,6 +601,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); @@ -617,6 +622,8 @@ OUString ScModelObj::getPartName( int nPart ) { OUString sTabName; ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + return OUString(); pViewData->GetDocument().GetName(nPart, sTabName); return sTabName; } @@ -625,6 +632,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()); }