diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2012-01-10 11:42:11 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-01-10 12:29:34 +0100 |
commit | 334bbec9d40eec73fd67652210a67f90966a360b (patch) | |
tree | 72bd1e17c06ea3dee7288233bc2848d72165477b | |
parent | 46daad95f8b65b91a0a30bda451dceff05408ecd (diff) |
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).
-rw-r--r-- | sd/source/core/stlpool.cxx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index f6ee1bddb9cb..3625bbf196c7 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; + } } } |