sw/source/uibase/shells/drwbassh.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit fbd98d923e75c90e750bd5d5a6cca80a75ed1ca9
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Wed Feb 2 21:14:30 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Feb 4 14:47:57 2022 +0100

    tdf#147144: Writer crash after adding rectangle, add link and delete it
    
    bt:
    0  SdrMark::GetMarkedSdrObj() const (this=0x0) at include/svx/svdmark.hxx:68
    1  0x00007f958c31555c in SwDrawBaseShell::GetState(SfxItemSet&) 
(this=0x6bbcd70, rSet=
        SfxItemSet of pool 0x2dc5730 with parent 0x0 and Which ranges: [(5678, 
5678), ... = {...}) at sw/source/uibase/shells/drwbassh.cxx:899
    2  0x00007f958c3148bd in SfxStubSwDrawBaseShellGetState(SfxShell*, 
SfxItemSet&)
        (pShell=0x6bbcd70, rSet=SfxItemSet of pool 0x2dc5730 with parent 0x0 
and Which ranges: [(5678, 5678),...] = {...}) at 
workdir/SdiTarget/sw/sdi/swslots.hxx:8315
    3  0x00007f95a6025de1 in SfxDispatcher::FillState_(SfxSlotServer const&, 
SfxItemSet&, SfxSlot const*)
        (this=0x65acbe0, rSvr=..., rState=SfxItemSet of pool 0x2dc5730 with 
parent 0x0 and Which ranges: [(5678, 5678), (5713, 5713),...] =
        {...}, pRealSlot=0x7f958d1eb190 <aSwDrawBaseShellSlots_Impl>) at 
sfx2/source/control/dispatch.cxx:1658
    4  0x00007f95a6004fe9 in SfxBindings::Update_Impl(SfxStateCache&) 
(this=0x65863c0, rCache=...) at sfx2/source/control/bindings.cxx:259
    
    Change-Id: I910429103f505e855d88b7efe9a5ca771d5fc92e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129388
    Tested-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    (cherry picked from commit 91fd537a4517409da87229fd7c0f21d269973d43)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129344
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index ff8579368812..f18d63b10ff3 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -896,11 +896,14 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
             case SID_HYPERLINK_GETLINK:
             {
                 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
-                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-                OUString sHyperLink = pObj->getHyperlink();
-                SvxHyperlinkItem aHLinkItem;
-                aHLinkItem.SetURL(sHyperLink);
-                rSet.Put(aHLinkItem);
+                if (rMarkList.GetMark(0) != nullptr)
+                {
+                    SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+                    OUString sHyperLink = pObj->getHyperlink();
+                    SvxHyperlinkItem aHLinkItem;
+                    aHLinkItem.SetURL(sHyperLink);
+                    rSet.Put(aHLinkItem);
+                }
             }
             break;
         }

Reply via email to