sfx2/source/control/dispatch.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit 3bd061338efcc492bd039bbae1f922efc5ac9478 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon May 19 09:20:32 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon May 19 11:55:46 2025 +0200 null deref of SfxMedium #1 SfxMedium::GetItemSet (this=0x0) at sfx2/source/doc/docfile.cxx:3816 #2 0x00007d70ffdfc395 in SfxDispatcher::Update_Impl_ (this=0x250de660, bUIActive=true, bIsMDIApp=true, bIsIPOwner=false, pTaskWin=0x24dcbce0) at include/sfx2/objsh.hxx:271 #3 0x00007d70ffdfe275 in SfxDispatcher::Update_Impl (this=this@entry=0x250de660, bForce=bForce@entry=true) at sfx2/source/control/dispatch.cxx:1121 #4 0x00007d70ffe09955 in DispatcherUpdate_Impl (pArg=0x250de660) at sfx2/source/control/shell.cxx:662 #5 0x00007d7101189d20 in Link<void*, void>::Call (data=<optimized out>, this=0x221a71f8) at include/tools/link.hxx:111 #6 ImplHandleUserEvent (pSVEvent=0x221a71f0) at vcl/source/window/winproc.cxx:2285 #7 ImplWindowFrameProc (_pWindow=<optimized out>, nEvent=SalEvent::UserEvent, pEvent=0x221a71f0) at vcl/source/window/winproc.cxx:2849 #8 0x00007d710167754c in SalFrame::CallCallback (pEvent=0x221a71f0, nEvent=SalEvent::UserEvent, this=0x160a7d50) at vcl/inc/salframe.hxx:311 #9 SvpSalInstance::ProcessEvent (this=0x136a0ed0, aEvent=...) at vcl/headless/svpinst.cxx:271 Change-Id: I4abdb71e25aed5d4021d0d1684bb5171ad57a705 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185503 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 7b646c57ce14..27d4afbbb82b 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1190,7 +1190,8 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne { bool bViewerTbx( nFlags & SfxVisibilityFlags::Viewer ); SfxObjectShell* pSh = xImp->pFrame->GetObjectShell(); - const SfxBoolItem* pItem = pSh->GetMedium()->GetItemSet().GetItem(SID_VIEWONLY, false); + const SfxMedium* pMedium = pSh->GetMedium(); + const SfxBoolItem* pItem = pMedium ? pMedium->GetItemSet().GetItem(SID_VIEWONLY, false) : nullptr; bool bIsViewer = pItem && pItem->GetValue(); if ( bIsViewer != bViewerTbx ) continue;