[Libreoffice-commits] .: sd/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Jan 10 03:21:01 PST 2012


 sd/source/core/stlpool.cxx |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

New commits:
commit 897aa4fa71813ca188b0e1e01ca41ca1e35d415d
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Jan 10 11:42:11 2012 +0100

    Tools container rework regression fix (for fdo#41657)
    
    Don't de-reference invalid iterator (and no point in doing anything
    with an empty style sheet list anyway).

diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index f6ee1bd..3625bbf 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -681,24 +681,26 @@ void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetP
     std::vector<SfxStyleSheetBase*> aOutlineSheets;
     CreateOutlineSheetList(rLayoutName,aOutlineSheets);
 
-    std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
-
-    SfxStyleSheetBase* pParent = *it;
-    ++it;
-
-    while (it != aOutlineSheets.end())
+    if( !aOutlineSheets.empty() )
     {
-        pSheet = *it;
+        std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
+        SfxStyleSheetBase* pParent = *it;
+        ++it;
 
-        if (!pSheet)
-            break;
+        while (it != aOutlineSheets.end())
+        {
+            pSheet = *it;
 
-        if (pSheet->GetParent().Len() == 0)
-            pSheet->SetParent(pParent->GetName());
+            if (!pSheet)
+                break;
 
-        pParent = pSheet;
+            if (pSheet->GetParent().Len() == 0)
+                pSheet->SetParent(pParent->GetName());
 
-        ++it;
+            pParent = pSheet;
+
+            ++it;
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list