diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-24 19:28:25 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-06-03 14:31:33 +0200 |
commit | 80f3a0b928325774c72c7654699918c39aca4ea3 (patch) | |
tree | 16b1601f5a7e039ca5c42c5cf912fef947166f90 /sc | |
parent | c9a79120a847f716fadfa1433e09679051714a74 (diff) |
cid#1598442 Dereference null return value
Change-Id: Id44fb940ba17549068c5be554d5738ce81ced79a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168028
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 50c718557da8d3141377a10a4a944736111a1494)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168193
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index ac3b3a53ed9b..fc7c56bd624d 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -472,6 +472,9 @@ void ScUndoDeleteTab::Undo() void ScUndoDeleteTab::Redo() { ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + if (!pViewShell) + return; + pViewShell->SetTabNo( lcl_GetVisibleTabBefore( pDocShell->GetDocument(), theTabs.front() ) ); RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first @@ -1000,16 +1003,13 @@ void ScUndoImportTab::DoChange() const ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); - if (pViewShell) + if(nTab<nTabCount) { - if(nTab<nTabCount) - { - pViewShell->SetTabNo(nTab,true); - } - else - { - pViewShell->SetTabNo(nTab-1,true); - } + pViewShell->SetTabNo(nTab,true); + } + else + { + pViewShell->SetTabNo(nTab-1,true); } SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) ); // Navigator @@ -1228,8 +1228,7 @@ void ScUndoShowHideTab::DoChange( bool bShowP ) const for(const SCTAB& nTab : undoTabs) { rDoc.SetVisible( nTab, bShowP ); - if (pViewShell) - pViewShell->SetTabNo(nTab,true); + pViewShell->SetTabNo(nTab,true); } SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) ); |