summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/swhtml.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-26 20:38:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-10-27 09:41:37 +0100
commit7ae9e8b6ba35dec2c556f6fac4034cd9bb1111a1 (patch)
tree5f92c9c36baac7cb8f4a9acf39cbde87706954ac /sw/source/filter/html/swhtml.cxx
parentb69a5f5e6c909806489c6fb85722802fb9a276f1 (diff)
ofz#26619 detect if SwFrameFormat deleted during import
Change-Id: I5dc778e44dcb670353e83037a5a5d469fa437186 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104853 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/html/swhtml.cxx')
-rw-r--r--sw/source/filter/html/swhtml.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index c7810ee60ad6..c74b2d99edb7 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2696,6 +2696,18 @@ SwViewShell *SwHTMLParser::CheckActionViewShell()
return m_pActionViewShell;
}
+SwHTMLFrameFormatListener::SwHTMLFrameFormatListener(SwFrameFormat* pFrameFormat)
+ : m_pFrameFormat(pFrameFormat)
+{
+ StartListening(m_pFrameFormat->GetNotifier());
+}
+
+void SwHTMLFrameFormatListener::Notify(const SfxHint& rHint)
+{
+ if (rHint.GetId() == SfxHintId::Dying)
+ m_pFrameFormat = nullptr;
+}
+
void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
std::deque<std::unique_ptr<HTMLAttr>> *pPostIts )
{
@@ -2955,7 +2967,14 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
for( auto n = m_aMoveFlyFrames.size(); n; )
{
- SwFrameFormat *pFrameFormat = m_aMoveFlyFrames[ --n ];
+ SwFrameFormat *pFrameFormat = m_aMoveFlyFrames[--n]->GetFrameFormat();
+ if (!pFrameFormat)
+ {
+ SAL_WARN("sw.html", "SwFrameFormat deleted during import");
+ m_aMoveFlyFrames.erase( m_aMoveFlyFrames.begin() + n );
+ m_aMoveFlyCnts.erase( m_aMoveFlyCnts.begin() + n );
+ continue;
+ }
const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
OSL_ENSURE( RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId(),