Kaydet (Commit) ee636db4 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1169835 Improper use of negative value

Change-Id: I1857f5c712f9407c8a4b69f30044e8bb444afad2
üst f3e519d4
...@@ -489,7 +489,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos) ...@@ -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 n1 = nTokPos < 0 ? -1 : aFormString.indexOf(sep, nTokPos);
const sal_Int32 n2 = nTokPos < 0 ? -1 : aFormString.indexOf(')',nTokPos); const sal_Int32 n2 = nTokPos < 0 ? -1 : aFormString.indexOf(')',nTokPos);
sal_Int32 nXXX = nTokPos; sal_Int32 nXXX = nTokPos;
if( n1 < n2 ) if( n1 < n2 && n1 != -1 )
{ {
nTokPos=n1; nTokPos=n1;
} }
...@@ -501,8 +501,8 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos) ...@@ -501,8 +501,8 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
{ {
aArgs[0] = *pNextToken; aArgs[0] = *pNextToken;
const OUString a2String = xParser->printFormula(aArgs, aRefPos); const OUString a2String = xParser->printFormula(aArgs, aRefPos);
const sal_Int32 n3 = aFormString.indexOf(a2String,nXXX); const sal_Int32 n3 = nXXX < 0 ? -1 : aFormString.indexOf(a2String, nXXX);
if ( n3 < nTokPos ) if (n3 < nTokPos && n3 != -1)
nTokPos = n3; nTokPos = n3;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment