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
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 905c55d..9dcb56a 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 );
}