[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 11 06:01:11 PST 2012


 sc/source/core/data/drwlayer.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 9fae191ea8438777d5c1dd20b20506e131707454
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Jan 11 08:59:49 2012 -0500

    Avoid iterating beyond the last existing drawing page.

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 74c9d35..82fbf7b 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));


More information about the Libreoffice-commits mailing list