summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-11 17:51:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-11 21:05:54 +0100
commitee636db4dd742e14c052a0974d3bf593f3181309 (patch)
tree8090935cb9cec333f138ffcfa96aafe3d4a4a7df /formula
parentf3e519d4242d66d61d54417645005fff5e3747aa (diff)
coverity#1169835 Improper use of negative value
Change-Id: I1857f5c712f9407c8a4b69f30044e8bb444afad2
Diffstat (limited to 'formula')
-rw-r--r--formula/source/ui/dlg/formula.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 6c6fc7b3331f..11d36ccc7ca7 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -489,7 +489,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
const sal_Int32 n1 = nTokPos < 0 ? -1 : aFormString.indexOf(sep, nTokPos);
const sal_Int32 n2 = nTokPos < 0 ? -1 : aFormString.indexOf(')',nTokPos);
sal_Int32 nXXX = nTokPos;
- if( n1 < n2 )
+ if( n1 < n2 && n1 != -1 )
{
nTokPos=n1;
}
@@ -501,8 +501,8 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
{
aArgs[0] = *pNextToken;
const OUString a2String = xParser->printFormula(aArgs, aRefPos);
- const sal_Int32 n3 = aFormString.indexOf(a2String,nXXX);
- if ( n3 < nTokPos )
+ const sal_Int32 n3 = nXXX < 0 ? -1 : aFormString.indexOf(a2String, nXXX);
+ if (n3 < nTokPos && n3 != -1)
nTokPos = n3;
}
}