diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-04-04 11:51:38 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-04-04 11:51:38 +0100 |
commit | 0131c3ea0e4b0275858b342cc4ccf768790181a1 (patch) | |
tree | 9e6f67e1e5704ff7c08aa5ba216044ce28720f6c /writerperfect | |
parent | remove legacysmgr_component_writeinfo fromt the .map files (diff) | |
download | core-0131c3ea0e4b0275858b342cc4ccf768790181a1.tar.gz core-0131c3ea0e4b0275858b342cc4ccf768790181a1.zip |
fix crasher in header / footnotes with no occurrence set
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/filter/DocumentCollector.cxx | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/writerperfect/source/filter/DocumentCollector.cxx b/writerperfect/source/filter/DocumentCollector.cxx index 22c37056a13d..fa077b4b4305 100644 --- a/writerperfect/source/filter/DocumentCollector.cxx +++ b/writerperfect/source/filter/DocumentCollector.cxx @@ -456,14 +456,20 @@ void DocumentCollector::openPageSpan(const WPXPropertyList &propList) mWriterDocumentStates.top().mbFirstParagraphInPageSpan = true; } +static bool +isOccurrenceEven (const WPXPropertyList &propList) +{ + const WPXProperty *occurance = propList["libwpd:occurrence"]; + return occurance && occurance->getStr() == "even"; +} + void DocumentCollector::openHeader(const WPXPropertyList &propList) { std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>; - - if (propList["libwpd:occurrence"]->getStr() == "even") - mpCurrentPageSpan->setHeaderLeftContent(pHeaderFooterContentElements); - else - mpCurrentPageSpan->setHeaderContent(pHeaderFooterContentElements); + if (isOccurrenceEven (propList)) + mpCurrentPageSpan->setHeaderLeftContent(pHeaderFooterContentElements); + else + mpCurrentPageSpan->setHeaderContent(pHeaderFooterContentElements); mpCurrentContentElements = pHeaderFooterContentElements; } @@ -477,10 +483,10 @@ void DocumentCollector::openFooter(const WPXPropertyList &propList) { std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>; - if (propList["libwpd:occurrence"]->getStr() == "even") - mpCurrentPageSpan->setFooterLeftContent(pHeaderFooterContentElements); - else - mpCurrentPageSpan->setFooterContent(pHeaderFooterContentElements); + if (isOccurrenceEven (propList)) + mpCurrentPageSpan->setFooterLeftContent(pHeaderFooterContentElements); + else + mpCurrentPageSpan->setFooterContent(pHeaderFooterContentElements); mpCurrentContentElements = pHeaderFooterContentElements; } |