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

New commits:
commit f0e209916df75c24984bf97b3b6d9391855eebc1
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Thu Mar 24 22:02:17 2022 +0100
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Mon Mar 28 16:55:47 2022 +0200

    sc: fix crash in SdrPageView::GetPageWindow()
    
    From 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/+/132091
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit c8bfb498ca93b990069d7bcd09cb1240d8c8faee)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132053
    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 7480fe0e515b..46525e96b164 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1434,7 +1434,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