sw/source/core/undo/unattr.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit d39651a69d789522b2faffd01879db25354b9a22
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Thu Aug 27 15:13:08 2020 +0300
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Sep 15 11:04:25 2020 +0200

    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.st...@cib.de>
    Tested-by: Jenkins

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 );
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to