diff options
Diffstat (limited to 'sw/source/filter/html/htmlatr.cxx')
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index c880082018..f298f93dc5 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1524,8 +1524,9 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, for (auto it = items.begin(); it != items.end();) { - HTMLStartEndPos* pTest = *it; - sal_Int32 nTestEnd = pTest->GetEnd(); + auto itTest = it++; // forward early, allow 'continue', and keep a copy for 'erase' + HTMLStartEndPos* pTest = *itTest; + const sal_Int32 nTestEnd = pTest->GetEnd(); if (nTestEnd <= nStart) continue; @@ -1533,28 +1534,25 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, const SfxPoolItem& rTestItem = pTest->GetItem(); // only the corresponding OnTag attributes have to be considered - if (rTestItem.Which() == nWhich && HTML_ON_VALUE == GetHTMLItemState(rTestItem)) - { - // if necessary, insert the second part of the split - // attribute - if (nTestEnd > nEnd) - InsertItem(pTest->GetItem(), nEnd, nTestEnd); + if (rTestItem.Which() != nWhich || HTML_ON_VALUE != GetHTMLItemState(rTestItem)) + continue; - if (nTestStart >= nStart) - { - // the Test item only starts after the new end of the - // attribute. Therefore, it can be completely erased. - it = items.erase(it); - std::erase(m_aEndLst[pTest->GetEnd()], pTest); - delete pTest; - continue; - } + // if necessary, insert the second part of the split attribute + if (nTestEnd > nEnd) + InsertItem(rTestItem, nEnd, nTestEnd); - // the start of the new attribute corresponds to the new - // end of the attribute - FixSplittedItem(pTest, nStart); + if (nTestStart >= nStart) + { + // the Test item only starts after the new end of the + // attribute. Therefore, it can be completely erased. + it = items.erase(itTest); + std::erase(m_aEndLst[nTestEnd], pTest); + delete pTest; + continue; } - ++it; + + // the start of the new attribute corresponds to the new end of the attribute + FixSplittedItem(pTest, nStart); } } } |