summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-19 15:32:53 +0000
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-04-21 13:24:11 +0200
commit1b06eb6c96ecfe0c39f50889797ddbf6b839a9e6 (patch)
tree8c938b7aad1ad10d4e2092516e35c95bf6a03bd1
parent7b3ea547bddd08e483c49ed5b3ff822f782a0aae (diff)
cid#1474166 Deference null return value
Change-Id: I725eff105f963b139ae8646cd1cb193ce737d313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112760 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 229558c0bf257e4e559cc1b84bd2918b04c68305) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114365 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
-rw-r--r--svx/source/form/fmview.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 3a4b443f4541..79651f7ab732 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -499,24 +499,26 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
// tdf#139804 Allow selecting form controls with Alt-<Mnemonic>
if (rKeyCode.IsMod2() && rKeyCode.GetCode())
{
- FmFormPage* pCurPage = GetCurPage();
- for (size_t a = 0; a < pCurPage->GetObjCount(); ++a)
+ if (FmFormPage* pCurPage = GetCurPage())
{
- SdrObject* pObj = pCurPage->GetObj(a);
- FmFormObj* pFormObject = FmFormObj::GetFormObject(pObj);
- if (!pFormObject)
- continue;
-
- Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin);
- if (!xControl.is())
- continue;
- const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
- if (rI18nHelper.MatchMnemonic(pWindow->GetText(), rKEvt.GetCharCode()))
+ for (size_t a = 0; a < pCurPage->GetObjCount(); ++a)
{
- pWindow->GrabFocus();
- bDone = true;
- break;
+ SdrObject* pObj = pCurPage->GetObj(a);
+ FmFormObj* pFormObject = FmFormObj::GetFormObject(pObj);
+ if (!pFormObject)
+ continue;
+
+ Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin);
+ if (!xControl.is())
+ continue;
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ if (rI18nHelper.MatchMnemonic(pWindow->GetText(), rKEvt.GetCharCode()))
+ {
+ pWindow->GrabFocus();
+ bDone = true;
+ break;
+ }
}
}
}