[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jun 29 15:27:49 UTC 2018


 sw/source/uibase/docvw/edtwin.cxx |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit c73da9a983bad3757d96f2a6be3101445ed58693
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jun 29 14:47:04 2018 +0200

    sw: fix crash on F2 while drawing a polygon
    
    The first hunk is probably a regression from my earlier TextBox work,
    the other is inherited from OOo, I think.
    
    Change-Id: If87d135c84c483d7a39f90e9edcf00594204fab8
    Reviewed-on: https://gerrit.libreoffice.org/56689
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 5e509ee18ec3..09f2794b067e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -192,7 +192,11 @@ static SfxShell* lcl_GetTextShellFromDispatcher( SwView const & rView );
 /// Check if the selected shape has a TextBox: if so, go into that instead.
 static bool lcl_goIntoTextBox(SwEditWin& rEditWin, SwWrtShell& rSh)
 {
-    SdrObject* pSdrObject = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+    SdrMark* pMark = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0);
+    if (!pMark)
+        return false;
+
+    SdrObject* pSdrObject = pMark->GetMarkedSdrObj();
     SwFrameFormat* pObjectFormat = ::FindFrameFormat(pSdrObject);
     if (SwFrameFormat* pTextBoxFormat = SwTextBoxHelper::getOtherTextBoxFormat(pObjectFormat, RES_DRAWFRMFMT))
     {
@@ -2301,12 +2305,15 @@ KEYINPUT_CHECKTABLE:
         break;
         case SwKeyState::GoIntoDrawing:
         {
-            SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
-            if(pObj)
+            if (SdrMark* pMark = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0))
             {
-                EnterDrawTextMode(pObj->GetLogicRect().Center());
-                if (dynamic_cast< const SwDrawTextShell *>(  m_rView.GetCurShell() ) != nullptr  )
-                    static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+                SdrObject* pObj = pMark->GetMarkedSdrObj();
+                if(pObj)
+                {
+                    EnterDrawTextMode(pObj->GetLogicRect().Center());
+                    if (dynamic_cast< const SwDrawTextShell *>(  m_rView.GetCurShell() ) != nullptr  )
+                        static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+                }
             }
             eKeyState = SwKeyState::End;
         }


More information about the Libreoffice-commits mailing list