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.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-09-06 19:52:11 +01:00
parent ec1a56b2e1
commit c8eb95e840

View file

@ -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 );