From c8eb95e8407ef24436e0e8e218dce535df6bb2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 6 Sep 2024 19:52:11 +0100 Subject: [PATCH] cid#1619147 Dereference before null check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cui/source/dialogs/hldoctp.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 );