diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-24 19:28:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-24 22:34:18 +0200 |
commit | 50c718557da8d3141377a10a4a944736111a1494 (patch) | |
tree | 458ff7ce5ccafb74ec51439b289eb4cd6b756764 /sc/source/ui | |
parent | da15cb3d111f65356726ee5ed15bd82c73d5ccce (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>
Diffstat (limited to 'sc/source/ui')
-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 c12c54bad8ee..3cdeaeed1f76 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -475,6 +475,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 @@ -1003,16 +1006,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 @@ -1231,8 +1231,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 ) ); |