diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 11:10:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 12:17:19 +0100 |
commit | 967b623031cd115722e2708f1281282ca8dccbe0 (patch) | |
tree | 4e458c86f2db5f3dea5294cbb2831b1b64a4aa42 /sw | |
parent | c96802f0e2e553bfbb3bd036df95ea34d2f5741a (diff) |
unusual negative start point on split node undo
Change-Id: I787371e95d9787616ca713c808098b80e40acab0
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/unins.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 4ac9ecb76ba1..eafb7f4adcf1 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; |