summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/undo/undotab.cxx21
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 ) );