summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-01-11 08:59:49 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-11 09:01:20 -0500
commit9fae191ea8438777d5c1dd20b20506e131707454 (patch)
tree84918450f266a815deee1b8fc4881af23a129ff3 /sc
parent8ed9108aea7fa807fa9a6174df0235b0a3b1a09c (diff)
Avoid iterating beyond the last existing drawing page.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/drwlayer.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 74c9d35f659e..82fbf7b10a97 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -481,6 +481,15 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, sal_Bool b
void ScDrawLayer::ResetTab( SCTAB nStart, SCTAB nEnd )
{
+ SCTAB nPageSize = static_cast<SCTAB>(GetPageCount());
+ if (nPageSize < 0)
+ // No drawing pages exist.
+ return;
+
+ if (nEnd >= nPageSize)
+ // Avoid iterating beyond the last existing page.
+ nEnd = nPageSize - 1;
+
for (SCTAB i = nStart; i <= nEnd; ++i)
{
SdrPage* pPage = GetPage(static_cast<sal_uInt16>(i));