summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/view/tabvwshf.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 2b838bf69b04..8ed4937c1f8c 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -192,8 +192,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
else
--nTabNr;
- if ( nTabNr <= nTabCount )
- bOk = InsertTable( aName, nTabNr );
+ if (nTabNr > nTabCount)
+ nTabNr = nTabCount;
+
+ bOk = InsertTable(aName, nTabNr);
}
if (bOk)