summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-06-22 11:02:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-06-22 13:23:04 +0200
commit4d9bbb7dc9189da962d0f8a21e252a5e34701863 (patch)
treec6e2b11c8be76d4dd2f1294839151c68e080b2f6 /svx
parent9f3bce835e81dbdf07da9850a5157f4403819417 (diff)
crashreporting: apparent null derefs of SfxViewFrame::Current()
Change-Id: I0e2c07a7eaa0a13be0a44c7cd187feec8ed4c2c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136240 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/srchdlg.cxx24
1 files changed, 14 insertions, 10 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 1efaa5d8f1ae..b047ef27d1e7 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2344,16 +2344,12 @@ SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
return aInfo;
}
-static void lcl_SetSearchLabelWindow(const OUString& rStr)
+static void lcl_SetSearchLabelWindow(const OUString& rStr, SfxViewFrame& rViewFrame)
{
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (!pViewFrame)
- return;
-
bool bNotFound = rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
css::uno::Reference< css::beans::XPropertySet > xPropSet(
- pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
+ rViewFrame.GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue("LayoutManager") >>= xLayoutManager;
css::uno::Reference< css::ui::XUIElement > xUIElement =
@@ -2424,6 +2420,10 @@ OUString SvxSearchDialogWrapper::GetSearchLabel()
void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (!pViewFrame)
+ return;
+
OUString sStr;
if (rSL == SearchLabel::End)
sStr = SvxResId(RID_SVXSTR_SEARCH_END);
@@ -2444,17 +2444,21 @@ void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
else if (rSL == SearchLabel::ReminderStartWrapped)
sStr = SvxResId(RID_SVXSTR_SEARCH_REMINDER_START_WRAPPED);
- lcl_SetSearchLabelWindow(sStr);
- if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
+ lcl_SetSearchLabelWindow(sStr, *pViewFrame);
+
+ if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame->
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
pWrp->getDialog()->SetSearchLabel(sStr);
}
void SvxSearchDialogWrapper::SetSearchLabel(const OUString& sStr)
{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (!pViewFrame)
+ return;
- lcl_SetSearchLabelWindow(sStr);
- if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
+ lcl_SetSearchLabelWindow(sStr, *pViewFrame);
+ if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( pViewFrame->
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
pWrp->getDialog()->SetSearchLabel(sStr);
}