[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/source

Caolán McNamara caolanm at redhat.com
Wed Jun 19 08:50:04 PDT 2013


 sw/source/core/undo/unins.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit db83cb5a7e1703b512676df6e4dfb103d936d56d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 19 11:10:08 2013 +0100

    unusual negative start point on split node undo
    
    Change-Id: I787371e95d9787616ca713c808098b80e40acab0
    (cherry picked from commit 967b623031cd115722e2708f1281282ca8dccbe0)
    Reviewed-on: https://gerrit.libreoffice.org/4360
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>

diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 4ac9ecb..eafb7f4 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -74,9 +74,18 @@ String * SwUndoInsert::GetTxtFromDoc() const
 
     if( pCNd->IsTxtNode() )
     {
-        pResult = new String(
-            static_cast<SwTxtNode*>(pCNd)->GetTxt().copy(nCntnt-nLen, nLen));
+        OUString sTxt = static_cast<SwTxtNode*>(pCNd)->GetTxt();
 
+        sal_Int32 nStart = nCntnt-nLen;
+        sal_Int32 nLength = nLen;
+
+        if (nStart < 0)
+        {
+            nLength += nStart;
+            nStart = 0;
+        }
+
+        pResult = new String(sTxt.copy(nStart, nLength));
     }
 
     return pResult;


More information about the Libreoffice-commits mailing list