diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-04 21:00:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-04 21:00:45 +0100 |
commit | 4e96b278965875a95f02993590f30ab5859c1fed (patch) | |
tree | ab4ae7db38d82ea8bbde937f4989aded03ca3ef5 | |
parent | 4cc2fb2db34337880393d692d0e9ea8d6496fcbf (diff) |
Resolves: tdf#91637 avoid -1 string index
Change-Id: I006040f4589065141310fe2a89b8d2ba3e54ad2c
-rw-r--r-- | sw/source/core/fields/expfld.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index b9007ab4e86e..e7da51037144 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -746,8 +746,11 @@ bool SwSeqFieldList::SeekEntry( const _SeqFieldLstElem& 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 ); |