diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-18 10:42:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-20 07:49:58 +0000 |
commit | f80bcfb2907bb4c2999280c8d1be060292122659 (patch) | |
tree | 95af94f6168adfe46d4f083b4627d026818a42fc | |
parent | 1c99d62187b73828b5e5a2b8e504dfe6d4150cbd (diff) |
protect against empty m_aTableManagers stack
Change-Id: I29fecc5e0efb3b3d907f0c6505d42818fa464ffc
(cherry picked from commit 9d76d9d9abb08788f2882612cfe6d0df6e19af39)
Reviewed-on: https://gerrit.libreoffice.org/27281
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 808d72592aa6e9a9f9a8eddd4dada0fa9f14749c)
Reviewed-on: https://gerrit.libreoffice.org/27320
Reviewed-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 9 |
3 files changed, 19 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 80206df9244d..4a08120ffcfd 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1040,8 +1040,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) void DomainMapper::lcl_sprm(Sprm & rSprm) { - if( !m_pImpl->getTableManager().sprm(rSprm)) - sprmWithProps( rSprm, m_pImpl->GetTopContext() ); + if (!m_pImpl->hasTableManager() || !m_pImpl->getTableManager().sprm(rSprm)) + sprmWithProps(rSprm, m_pImpl->GetTopContext()); } sal_Int32 lcl_getCurrentNumberingProperty( @@ -2795,7 +2795,8 @@ void DomainMapper::lcl_endSectionGroup() void DomainMapper::lcl_startParagraphGroup() { - m_pImpl->getTableManager().startParagraphGroup(); + if (m_pImpl->hasTableManager()) + m_pImpl->getTableManager().startParagraphGroup(); /* * Add new para properties only if paragraph is not split * or the top context is not of paragraph properties @@ -2832,7 +2833,8 @@ void DomainMapper::lcl_startParagraphGroup() void DomainMapper::lcl_endParagraphGroup() { m_pImpl->PopProperties(CONTEXT_PARAGRAPH); - m_pImpl->getTableManager().endParagraphGroup(); + if (m_pImpl->hasTableManager()) + m_pImpl->getTableManager().endParagraphGroup(); //frame conversion has to be executed after table conversion m_pImpl->ExecuteFrameConversion(); m_pImpl->SetIsOutsideAParagraph(true); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a219894076f2..6b8176ffdf18 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -266,11 +266,13 @@ DomainMapper_Impl::~DomainMapper_Impl() // Don't remove last paragraph when pasting, sw expects that empty paragraph. if (m_bIsNewDoc) RemoveLastParagraph(); - getTableManager( ).endLevel(); - popTableManager( ); + if (hasTableManager()) + { + getTableManager().endLevel(); + popTableManager(); + } } - uno::Reference< container::XNameContainer > DomainMapper_Impl::GetPageStyles() { if(!m_xPageStyles.is()) @@ -1034,7 +1036,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) TagLogger::getInstance().attribute("isTextAppend", sal_uInt32(xTextAppend.is())); #endif - if (xTextAppend.is() && !getTableManager( ).isIgnore() && pParaContext != nullptr) + if (xTextAppend.is() && pParaContext != nullptr && !getTableManager().isIgnore()) { try { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index be6bb2625ac0..710e06788a3e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -698,6 +698,11 @@ public: const bool bStart, const sal_Int32 nAnnotationId ); + bool hasTableManager() const + { + return !m_aTableManagers.empty(); + } + DomainMapperTableManager& getTableManager() { std::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top(); @@ -718,8 +723,8 @@ public: void popTableManager( ) { - if ( m_aTableManagers.size( ) > 0 ) - m_aTableManagers.pop( ); + if (hasTableManager()) + m_aTableManagers.pop(); } void SetLineNumbering( sal_Int32 nLnnMod, sal_uInt32 nLnc, sal_Int32 ndxaLnn ); |