cui/source/dialogs/hldoctp.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit c8eb95e8407ef24436e0e8e218dce535df6bb2e5
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Sep 6 19:52:11 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Sep 7 22:43:32 2024 +0200

    cid#1619147 Dereference before null check
    
    maybe it possible in --headless that ShowMarkWnd launches
    
    weld::DialogController::runAsync(mxMarkWnd, [this](sal_Int32 /*nResult*/) { 
mxMarkWnd.reset(); } );
    
    and the auto-cancel calls mxMarkWnd.reset() immediately?
    
    Otherwise, not sure how this could come about.
    
    Change-Id: I761ee7450a8ba54b2a7f75d4ee116c30319ddaa8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172976
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 52bda50b47ef..8a3974c7c2a0 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -207,6 +207,9 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, 
weld::Button&, void)
 {
     ShowMarkWnd();
 
+    if (!mxMarkWnd)
+        return;
+
     if ( GetPathType ( maStrURL ) == EPathType::ExistsFile  ||
          maStrURL.isEmpty() ||
          maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ||
@@ -216,13 +219,10 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, 
weld::Button&, void)
 
         weld::WaitObject aWait(mpDialog->getDialog());
 
-        if (mxMarkWnd)
-        {
-            if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
-                mxMarkWnd->RefreshTree ( u""_ustr );
-            else
-                mxMarkWnd->RefreshTree ( maStrURL );
-        }
+        if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
+            mxMarkWnd->RefreshTree ( u""_ustr );
+        else
+            mxMarkWnd->RefreshTree ( maStrURL );
     }
     else
         mxMarkWnd->SetError( LERR_DOCNOTOPEN );

Reply via email to