summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/table3.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 4637e744e8b0..4ec4b420afaf 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2509,9 +2509,9 @@ public:
OUString aQuer( mpTransliteration->transliterate(
aQueryStr, ScGlobal::eLnge, 0, aQueryStr.getLength(),
NULL ) );
- sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH
- || rEntry.eOp == SC_DOES_NOT_END_WITH) ? (aCell.getLength()-aQuer.getLength()) : 0;
- sal_Int32 nStrPos = aCell.indexOf( aQuer, nIndex );
+ sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) ?
+ (aCell.getLength() - aQuer.getLength()) : 0;
+ sal_Int32 nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf( aQuer, nIndex ));
switch (rEntry.eOp)
{
case SC_EQUAL:
@@ -2529,10 +2529,10 @@ public:
bOk = ( nStrPos != 0 );
break;
case SC_ENDS_WITH:
- bOk = ( nStrPos + aQuer.getLength() == aCell.getLength() );
+ bOk = (nStrPos >= 0 && nStrPos + aQuer.getLength() == aCell.getLength() );
break;
case SC_DOES_NOT_END_WITH:
- bOk = ( nStrPos + aQuer.getLength() != aCell.getLength() );
+ bOk = (nStrPos < 0 || nStrPos + aQuer.getLength() != aCell.getLength() );
break;
default:
{