diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-22 11:02:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-22 13:38:49 +0200 |
commit | 257d80b4ab086aae504694d37e43c5b1a7d9a386 (patch) | |
tree | 67bec35bf7de8a56b32e6c2d749d5d8253e706f7 /svx | |
parent | d2de55c93f94bbccff51fa7715b613341f1f4ae6 (diff) |
crashreporting: apparent null derefs of SfxViewFrame::Current()
Change-Id: I0e2c07a7eaa0a13be0a44c7cd187feec8ed4c2c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136277
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 24 |
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); } |