sc/source/ui/unoobj/docuno.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 3d3f15040c7ed4f8d8e3fedf93b5042ae15b70c7 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu Dec 15 18:32:59 2022 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Dec 20 20:47:14 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/+/144251 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> 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()); }