sc/source/ui/view/gridwin4.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 5d0965f3f12fedb2228ba28f261a90245e343c09
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Thu Mar 24 22:02:17 2022 +0100
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Tue Mar 29 06:43:14 2022 +0200

    sc: fix crash in SdrPageView::GetPageWindow()
    
    From online crashreport:
    
    SIG   Fatal signal received: SIGSEGV
    
    SdrPageView::GetPageWindow(unsigned int) const
                    svx/source/svdraw/svdpagv.cxx:84
    (anonymous 
namespace)::ScLOKProxyObjectContact::calculateGridOffsetForViewOjectContact(basegfx::B2DVector&,
 sdr::contact::ViewObjectContact const&) const
                    sc/source/ui/view/gridwin4.cxx:1397
    sdr::contact::ViewObjectContact::getGridOffset() const
                    svx/source/sdr/contact/viewobjectcontact.cxx:463
    
sdr::contact::ViewObjectContact::getPrimitive2DSequence(sdr::contact::DisplayInfo
 const&) const
                    include/basegfx/tuple/b2dtuple.hxx:81
    sdr::contact::ViewObjectContact::getObjectRange() const
                    svx/source/sdr/contact/viewobjectcontact.cxx:198
    
    ScLOKProxyObjectContact::calculateGridOffsetForViewOjectContact()
    didn't check if PageWindowCount() was non-zero.
    
    Change-Id: I4a00b5b13a277d0805af3076150a952306908e53
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132251
    Tested-by: Jenkins
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e1a2aa318df3..a12b190933bb 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1437,7 +1437,9 @@ namespace
             if (!pPageView)
                 return;
 
-            SdrPageWindow* pSdrPageWindow = pPageView->GetPageWindow(0);
+            SdrPageWindow* pSdrPageWindow = nullptr;
+            if (pPageView->PageWindowCount() > 0)
+                pSdrPageWindow = pPageView->GetPageWindow(0);
             if (!pSdrPageWindow)
                 return;
 

Reply via email to