diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-04-14 12:45:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-04-14 18:51:47 +0200 |
commit | 51c8c95b2864b49e7bcbd824eacedb5778a758c0 (patch) | |
tree | f129c282e0524ef62fba84f4b2dd106281e2db0f /sw | |
parent | 5e7f26787c6025ec1dffa9eee17405220325f7ae (diff) |
Resolves: fdo#48640 handle various busted rtf docs without hanging
(cherry picked from commit 234f150f30d881b2691288c5f5581306bd4d3d18)
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index ba7581fa0c9d..981f3c388be6 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1078,8 +1078,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes ) { + if (rTableNodes.empty()) + return NULL; + + std::vector<SwNodeRange> rFirstRange = *rTableNodes.begin(); + + if (rFirstRange.empty()) + return NULL; + /* Save first node in the selection if it is a content node. */ - SwCntntNode * pSttCntntNd = rTableNodes.begin()->begin()->aStart.GetNode().GetCntntNode(); + SwCntntNode * pSttCntntNd = rFirstRange.begin()->aStart.GetNode().GetCntntNode(); /**debug**/ #if OSL_DEBUG_LEVEL > 1 diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 71939e4a5159..bd356da8bad3 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2231,6 +2231,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) std::vector<VerticallyMergedCell> aMergedCells; SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes ); + + if (!pTable) + return uno::Reference< text::XTextTable >(); + SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() ); const uno::Reference< text::XTextTable > xRet = pTextTable; const uno::Reference< beans::XPropertySet > xPrSet = pTextTable; |