diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-08-01 15:50:00 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-08-01 19:28:54 +0200 |
commit | b47a8f091ad8f9048a6b7962e9cde5d04ea0d665 (patch) | |
tree | ed81395e7a810280e79d969cef7a6575ea788a4f /writerfilter | |
parent | 27c46ecf34b32bae1806d3fc0e1684179301feb8 (diff) |
tdf#126544 writerfilter: check parent style exists before assigning
If you set the parent style to a style that is not yet created,
then it silently fails, and thus inherits from nothing!
Change-Id: Ibb85235643dd5b1eb9b0bd43f701580f24b2b7fa
Reviewed-on: https://gerrit.libreoffice.org/76805
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 54b072768558..12b525f79e6d 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -982,7 +982,13 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier ); // Writer core doesn't support numbering styles having a parent style, it seems if (pParent.get() != nullptr && !bListStyle) - xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName )); + { + const OUString sParentStyleName = ConvertStyleName( pParent->sStyleName ); + if ( !sParentStyleName.isEmpty() && !xStyles->hasByName( sParentStyleName ) ) + aMissingParent.emplace_back( sParentStyleName, xStyle ); + else + xStyle->setParentStyle( sParentStyleName ); + } } catch( const uno::RuntimeException& ) { |