diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-08-01 15:50:00 +0300 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-10-31 11:55:23 +0100 |
commit | 5af351f9edd23e3a0e44b7aacb290ccf6a93f7a2 (patch) | |
tree | 0fa339d95665c3a3e52bd80a9a69730d7d2c7853 /writerfilter | |
parent | 0ab5be0e1e2a0149d57549613c32cee3668a7ac1 (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>
(cherry picked from commit b47a8f091ad8f9048a6b7962e9cde5d04ea0d665)
Reviewed-on: https://gerrit.libreoffice.org/81749
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
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 957cdbedf356..e6e37898347d 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -984,7 +984,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& ) { |