summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-04 21:00:13 +0100
committerMichael Stahl <mstahl@redhat.com>2015-06-04 20:06:11 +0000
commitb36afd1ecd098723e3119cba81e172396bf30f45 (patch)
treec6a7eb065daa6a8e317ce2ea61259f622af2b43e
parent01f77389b473a37a7b8e0e46a1e49a56dac478c3 (diff)
Resolves: tdf#91637 avoid -1 string index
Change-Id: I006040f4589065141310fe2a89b8d2ba3e54ad2c (cherry picked from commit 4e96b278965875a95f02993590f30ab5859c1fed) Reviewed-on: https://gerrit.libreoffice.org/16089 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/fields/expfld.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 310036319696..2fcdc425859d 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -739,8 +739,11 @@ bool SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, size_t* pP ) const
sal_Int32 nNum1 = sNum1.toInt32();
nCmp = nNum2 - nNum1;
if( 0 == nCmp )
- nCmp = rCaseColl.compareString( rTmp2.copy( nFndPos2 ),
- rTmp1.copy( nFndPos1 ));
+ {
+ OUString aTmp1 = nFndPos1 != -1 ? rTmp1.copy(nFndPos1) : OUString();
+ OUString aTmp2 = nFndPos2 != -1 ? rTmp2.copy(nFndPos2) : OUString();
+ nCmp = rCaseColl.compareString(aTmp2, aTmp1);
+ }
}
else
nCmp = rColl.compareString( rTmp2, rTmp1 );