diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2020-08-27 15:13:08 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-09-15 11:04:25 +0200 |
commit | d39651a69d789522b2faffd01879db25354b9a22 (patch) | |
tree | e3852c43ba713ed8d6d8305aeaa8cd6b35dfa148 | |
parent | 315919306c7b6e95db6a280c4aa8d2203970e292 (diff) |
sw: additional asserts/warns to diagnose empty style names
Since undo/redo is using format name instead of old approach
with pointers (which can point to invalid/removed style) it
is a problem when we trying to use any style without name:
it will be not resolved and undo/redo will work
incorrectly: it can apply invalid attributes or apply style
to another random objects.
Change-Id: Iccba3e8ab223955ce940dfc17d0bd4858bd364f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101472
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
-rw-r--r-- | sw/source/core/undo/unattr.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 905c55d97243..9dcb56ae83a0 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -99,6 +99,8 @@ SwUndoFormatAttr::SwUndoFormatAttr( const SfxItemSet& rOldSet, , m_nFormatWhich( rChgFormat.Which() ) , m_bSaveDrawPt( bSaveDrawPt ) { + assert(m_sFormatName.getLength()); + Init( rChgFormat ); } @@ -111,6 +113,8 @@ SwUndoFormatAttr::SwUndoFormatAttr( const SfxPoolItem& rItem, SwFormat& rChgForm , m_nFormatWhich( rChgFormat.Which() ) , m_bSaveDrawPt( bSaveDrawPt ) { + assert(m_sFormatName.getLength()); + m_pOldSet->Put( rItem ); Init( rChgFormat ); } |