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

New commits:
commit 46f2bd7e96cec80f57b12a60fefb16ecec866117
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue May 20 21:33:23 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed May 21 10:19:27 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

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index ad85ccc65b08..bde35636ad63 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -4267,14 +4267,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