diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-11 08:59:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-11 09:04:04 -0500 |
commit | 98aadb63dd07c51bdc2a0a0857c6ded05d7316f8 (patch) | |
tree | 24a738e6e2aef2c9086ba325bdf2bd9a06ab7b78 | |
parent | 25e0d64a6fccbc62d4cca4d8d7d312ea84f45c3a (diff) |
Avoid iterating beyond the last existing drawing page.
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 9 |
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)); |