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

New commits:
commit 2bbd6998aefe4a83c93a1810430f1a0da5364284
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Thu Mar 24 22:02:17 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Mar 29 10:32:34 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>
    (cherry picked from commit 5d0965f3f12fedb2228ba28f261a90245e343c09)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132181
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 5da4a54508d2..d1aa33f4c847 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1355,7 +1355,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