summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-18 17:26:41 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-18 17:26:41 +0100
commitb359eb77b2683cb7fbf52ed9706b5efdadd411ff (patch)
tree7b3b0e2a3a3b6ad4367092cfb097fc0b1b448a45 /sw
parentab8a7f9834f4f003fbf705218c039fde7cd23938 (diff)
undoapi: fix 0-pointer in SwNodes::ChgNode that did not crash before by luck
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/nodes.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 66b95fbf5167..efe7d8177ca6 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -231,6 +231,9 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz,
bool bSavePersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds));
bool bRestPersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this));
SwDoc* pDestDoc = rNds.GetDoc() != GetDoc() ? rNds.GetDoc() : 0;
+ OSL_ENSURE(!pDestDoc, "SwNodes::ChgNode(): "
+ "the code to handle text fields here looks broken\n"
+ "if the target is in a different document.");
if( !bRestPersData && !bSavePersData && pDestDoc )
bSavePersData = bRestPersData = TRUE;
@@ -307,7 +310,9 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz,
// Sonderbehandlung fuer die Felder!
if( pHts && pHts->Count() )
{
- int bToUndo = &pDestDoc->GetNodes() != &rNds;
+ // this looks fishy if pDestDoc != 0
+ bool const bToUndo = !pDestDoc &&
+ GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
for( USHORT i = pHts->Count(); i; )
{
USHORT nDelMsg = 0;