summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-15 16:20:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-15 19:31:33 +0000
commita0c24199e4905c8220fb4254dfd0b263a44626a7 (patch)
tree2809cd5a22a8c5a2c7ad498f3be81860c5de8925
parent1e3b7b9ca960e3cfec626bb4b155a791487f810c (diff)
likely fix for frequent SfxViewFrame::GetChildWindow() crash
crash report id: 58e9a91e-9feb-4eb4-a28e-27921d3e1b99 Change-Id: I110d96f1c73f95025918ccc4043dac40c5e1dc4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144240 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 7559b7bf2fb8..269bce441ed8 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -830,9 +830,13 @@ SvxSearchDialog* SwView::GetSearchDialog()
{
#if HAVE_FEATURE_DESKTOP
const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
- SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->GetChildWindow(nId) );
- auto pSrchDlg = pWrp ? pWrp->getDialog() : nullptr;
- return pSrchDlg;
+ SfxViewFrame* pFrame = SfxViewFrame::Current();
+ if (!pFrame)
+ return nullptr;
+ SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>(pFrame->GetChildWindow(nId));
+ if (!pWrp)
+ return nullptr;
+ return pWrp->getDialog();
#else
return nullptr;
#endif