diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-20 16:29:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-21 13:28:28 +0000 |
commit | 6cb076f6b08668cf2a0490fe17ce34e74969702a (patch) | |
tree | 9a3e312cadea1180b56d191a906f1d7d7109cc3e /sw/source/uibase/shells | |
parent | b428a97d88b08fadd63039482c09c17a5fbac3be (diff) |
sw: check GetWrtShellPtr()
Change-Id: I8d99e9108f6163eafb7576603826f8d02a0ff416
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147336
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/langhelper.cxx | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 7be3cce99304..23ea1abd6dfd 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -177,21 +177,24 @@ namespace SwLangHelper // when setting a new language attribute if (bForSelection) { - const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); - EEControlBits nCntrl = pEditEngine->GetControlWord(); - // turn off - nCntrl &= ~EEControlBits::ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - //turn back on - if (pVOpt->IsOnlineSpell()) - nCntrl |= EEControlBits::ONLINESPELLING; - else + if (SwWrtShell* pWrtShell = rView.GetWrtShellPtr()) + { + const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); + EEControlBits nCntrl = pEditEngine->GetControlWord(); + // turn off nCntrl &= ~EEControlBits::ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - pEditEngine->CompleteOnlineSpelling(); - rEditView.Invalidate(); + pEditEngine->SetControlWord(nCntrl); + + //turn back on + if (pVOpt->IsOnlineSpell()) + nCntrl |= EEControlBits::ONLINESPELLING; + else + nCntrl &= ~EEControlBits::ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); + + pEditEngine->CompleteOnlineSpelling(); + rEditView.Invalidate(); + } } if (!bForSelection) |