sfx2/source/doc/objstor.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 3e80af1031d64bf01c90849c35f86fb9b9616952
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue May 20 21:33:23 2025 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Tue May 27 12:54:56 2025 +0200

    null deref of SfxMedium seen
    
     #1  SfxMedium::GetItemSet (this=this@entry=0x0) at 
libreoffice/sfx2/source/doc/docfile.cxx:3816
     #2  0x00007fa2526680d8 in SfxMedium::GetBaseURL (this=0x0, 
bForSaving=bForSaving@entry=false)
         at libreoffice/sfx2/source/doc/docfile.cxx:685
     #3  0x00007fa2526e184a in SfxObjectShell::getDocumentBaseURL 
(this=<optimized out>) at libreoffice/include/sfx2/objsh.hxx:271
     #4  0x00007fa2453fbb26 in SwOLEObj::GetOleRef (this=0x3370d698) at 
libreoffice/sw/source/core/ole/ndole.cxx:1027
     #5  0x00007fa2452e3ded in SwFEShell::IsSelObjProtected (this=0x3385dee0, 
eType=eType@entry=FlyProtectFlags::Content)
         at libreoffice/sw/source/core/frmedt/feshview.cxx:2714
     #6  0x00007fa245b117b1 in SwView::ImpSetVerb (this=this@entry=0x33857340, 
nSelType=nSelType@entry=SelectionType::Ole)
         at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:191
     #7  0x00007fa245b139de in SwView::SelectShell (this=0x33857340) at 
libreoffice/sw/source/uibase/uiview/view.cxx:312
     #8  0x00007fa245b14237 in SwView::AttrChangedNotify (this=0x33857340) at 
libreoffice/sw/source/uibase/uiview/view.cxx:580
     #9  SwView::AttrChangedNotify (this=this@entry=0x33857340) at 
libreoffice/sw/source/uibase/uiview/view.cxx:542
     #10 0x00007fa245b1ec82 in SwView::Activate (this=0x33857340, 
bMDIActivate=<optimized out>)
         at libreoffice/sw/source/uibase/uiview/view1.cxx:101
    
    Change-Id: I8913088b3dda4d8a85f990ee038bfaa282e61773
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185579
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 46f2bd7e96cec80f57b12a60fefb16ecec866117)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185595
    (cherry picked from commit ef89b7e498d343d4accb274649f604d29f99c49e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185862
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5487fc0f2156..826c92cb4938 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -4288,14 +4288,16 @@ bool SfxObjectShell::QueryAllowExoticFormat_Impl( const 
uno::Reference< task::XI
 uno::Reference< task::XInteractionHandler > 
SfxObjectShell::getInteractionHandler() const
 {
     uno::Reference< task::XInteractionHandler > xRet;
-    if ( GetMedium() )
-        xRet = GetMedium()->GetInteractionHandler();
+    if (SfxMedium* pRetrMedium = GetMedium())
+        xRet = pRetrMedium->GetInteractionHandler();
     return xRet;
 }
 
 OUString SfxObjectShell::getDocumentBaseURL() const
 {
-    return GetMedium()->GetBaseURL();
+    if (SfxMedium* pRetrMedium = GetMedium())
+        return pRetrMedium->GetBaseURL();
+    return OUString();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to