summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documen7.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-11-07 14:34:41 +0100
committerEike Rathke <erack@redhat.com>2017-11-07 14:35:51 +0100
commit8b7551fb5c5416670b8ab70c2252d35bfaace3fa (patch)
tree3507af93835d82df0f88fe3cd36319348e47ea1a /sc/source/core/data/documen7.cxx
parentf657454b69c813b90a8b3c1adb2feef1066dbd35 (diff)
LimitRangeToAvailableSheets: check ValidTab() first
That already includes BCA_LISTEN_ALWAYS which only needs to be checked if the ordinary tab check failed in case the definition changed. Change-Id: Ic31daf67f600b48b76406f07ba039462c5944170
Diffstat (limited to 'sc/source/core/data/documen7.cxx')
-rw-r--r--sc/source/core/data/documen7.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 4340827035cb..b8d577b6b9c8 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -92,13 +92,15 @@ void ScDocument::EndListeningArea( const ScRange& rRange, bool bGroupListening,
bool ScDocument::LimitRangeToAvailableSheets( const ScRange& rRange, ScRange& o_rRange,
bool& o_bEntirelyOutOfBounds ) const
{
- if (rRange == BCA_LISTEN_ALWAYS)
- return false;
-
const SCTAB nMaxTab = GetTableCount() - 1;
if (ValidTab( rRange.aStart.Tab(), nMaxTab) && ValidTab( rRange.aEnd.Tab(), nMaxTab))
return false;
+ // Originally BCA_LISTEN_ALWAYS uses an implicit tab 0 and should had been
+ // valid already, but in case that would change..
+ if (rRange == BCA_LISTEN_ALWAYS)
+ return false;
+
SCTAB nTab1 = rRange.aStart.Tab();
SCTAB nTab2 = rRange.aEnd.Tab();
SAL_WARN("sc.core","ScDocument::LimitRangeToAvailableSheets - bad sheet range: " << nTab1 << ".." << nTab2 <<