summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-18 10:42:02 +0100
committerAndras Timar <andras.timar@collabora.com>2016-07-20 13:06:46 +0200
commit5aedb3e3bcb2cc2bc9c38a148ec75abe20b96838 (patch)
treebbeee69bb5aef18c65652a8c615c8ad915ba72f4
parentce0b14a644e7be95b676cd471dd00d076e19828c (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)
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx9
3 files changed, 19 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index c0a91760ef8a..fc7336c00829 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1076,8 +1076,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(
@@ -2838,7 +2838,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
@@ -2875,7 +2876,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 372e71fcc6d9..e3a521991e69 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -268,11 +268,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())
@@ -1033,7 +1035,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 0fa1374e26a5..b602a70a3c68 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -700,6 +700,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();
@@ -720,8 +725,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 );