diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-12-23 21:05:46 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-12-23 23:28:09 +0100 |
commit | ce67fc823880ac81dbf66f66c97fde21e9e5a733 (patch) | |
tree | 84ec521eb88ef1338d7b78eca8c02dd325c81411 | |
parent | 1d4da92f7ce8026a5433822d9b8f5728a308bb75 (diff) |
crashreporting: more checks of pActiveViewSh
See https://crashreport.libreoffice.org/stats/signature/ScInputHandler::SetMode(ScInputMode,rtl::OUString%20const%20*,ScEditEngineDefaulter%20*)
Change-Id: Ib0a07f4ee8d7da05960eaac14af561a6b624b0d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179263
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 4da004cd3c01..d62f61f0ef70 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2866,6 +2866,9 @@ void ScInputHandler::UpdateFormulaMode() { SfxApplication* pSfxApp = SfxGetpApp(); + if (!pActiveViewSh) + return; + bool bIsFormula = !bProtected; if (bIsFormula) { @@ -2875,7 +2878,7 @@ void ScInputHandler::UpdateFormulaMode() if ( bIsFormula ) { - if (!bFormulaMode && pActiveViewSh) + if (!bFormulaMode) { pActiveViewSh->GetViewData().SetEditHighlight(true); bFormulaMode = true; @@ -2999,18 +3002,20 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, S if ( eMode == eNewMode ) return; + if (!pActiveViewSh) + return; + ImplCreateEditEngine(); if (bProtected) { eMode = SC_INPUT_NONE; StopInputWinEngine( true ); - if (pActiveViewSh) - pActiveViewSh->GetActiveWin()->GrabFocus(); + pActiveViewSh->GetActiveWin()->GrabFocus(); return; } - if (eNewMode != SC_INPUT_NONE && pActiveViewSh) + if (eNewMode != SC_INPUT_NONE) // Disable paste mode when edit mode starts. pActiveViewSh->GetViewData().SetPasteMode( ScPasteFlags::NONE ); @@ -3027,8 +3032,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, S { if (StartTable(0, false, eMode == SC_INPUT_TABLE, pTopEngine)) { - if (pActiveViewSh) - pActiveViewSh->GetViewData().GetDocShell()->PostEditView( mpEditEngine.get(), aCursorPos ); + pActiveViewSh->GetViewData().GetDocShell()->PostEditView( mpEditEngine.get(), aCursorPos ); } } |