summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-02-25 22:06:18 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2013-02-25 21:19:36 +0000
commit3f5361a9402cd6df4da7fb98108ae1906b41edd3 (patch)
treea55e3efdec475b235f9eb0fc512af0d83a15689c
parent2681779cccc8a54bf7e81c4805c45c4200b8a697 (diff)
fdo#61428: SwTxtNode::ReplaceText: brown paperbag fix
Fix the optimization to return only if both replacement and replaced strings are empty. (regression from b6d45f26ea5bcc848737921b59a16253eb1d8587) Change-Id: I984fb151a5ac3e6eb8d03f854ad6a3df88f96000 (cherry picked from commit 3e6a0b6d04722d43a1fc8d3745b5e79b7ced90eb) Reviewed-on: https://gerrit.libreoffice.org/2407 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index ee1dd0185295..2cc28ae00390 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3337,9 +3337,9 @@ void SwTxtNode::ReplaceText( const SwIndex& rStart, const xub_StrLen nDelLen,
"SwTxtNode::ReplaceText: node text with insertion > TXTNODE_MAX.");
OUString const sInserted(
(nOverflow > 0) ? rStr.Copy(0, rStr.Len() - nOverflow) : rStr);
- if (sInserted.isEmpty())
+ if (sInserted.isEmpty() && 0 == nDelLen)
{
- return;
+ return; // nothing to do
}
const xub_StrLen nStartPos = rStart.GetIndex();