summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-02-25 22:06:18 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-02-26 09:15:24 +0000
commit282af14d3c021ad6927bc909161c0ff7b31fa1c9 (patch)
tree6807118beebd6a32485c5deb58ec8ee86c5c409a
parent7782a3aad25e96b8a26fbb192a6b54c1269b4efd (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> (cherry picked from commit 3f5361a9402cd6df4da7fb98108ae1906b41edd3) Reviewed-on: https://gerrit.libreoffice.org/2408 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
-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();