summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-09-09 12:48:04 +0300
committerJustin Luth <justin_luth@sil.org>2020-09-10 07:31:25 +0200
commit2dc30bd6ee88a2e3a1b4607c144f151e7329f3b9 (patch)
treefe92dbc1c896624383cb86b21e3a38e067f84c00 /writerfilter
parent833dd84e85a29734e69277a590f4f9942e9af8a2 (diff)
tdf#136587 writerfilter: prevent exception in applyStyleSheets
The only thing that a style needs to be valid is a name. In this case, there was no name imported, so the exception killed the import of the rest of the styles. As a test, I forced the empty name to "junk" and that also worked, so I am fairly confident that this is all that is necessary to prevent an exception. This improves on 7.1 commit for tdf#68326. NOTE: this unit test does prove that LO is not importing the Normal style at all. It should import with fontsize 32. So a proper reading of the RTF file would also have solved the bug. Change-Id: I9258bf985a501952dcd5aa52e54f920c99e509f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102315 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index aa08e854ca08..ec258b7377c3 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -947,7 +947,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
std::vector<beans::PropertyValue> aTableStylesVec;
for( auto& pEntry : m_pImpl->m_aStyleSheetEntries )
{
- if( pEntry->nStyleTypeCode == STYLE_TYPE_UNKNOWN )
+ if( pEntry->nStyleTypeCode == STYLE_TYPE_UNKNOWN && !pEntry->sStyleName.isEmpty() )
pEntry->nStyleTypeCode = STYLE_TYPE_PARA; // unspecified style types are considered paragraph styles
if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA || pEntry->nStyleTypeCode == STYLE_TYPE_LIST )