Fixed issue #964. Assign operator crashes math parser.
--HG-- branch : release
This commit is contained in:
parent
8a58ccdb3a
commit
a8ec25caf7
|
@ -20,6 +20,7 @@
|
|||
- [#957] Unable to cut an arc with negative length.
|
||||
- [#962] Failed to load LibEGL.
|
||||
- [#963] Bug in tool Point intersect curve and axis.
|
||||
- [#964] Assign operator crashes math parser.
|
||||
|
||||
# Version 0.6.1 October 23, 2018
|
||||
- [#885] Regression. Broken support for multi size measurements.
|
||||
|
|
|
@ -915,7 +915,11 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
|
|||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT(a_stVal.size()>=2);
|
||||
if(a_stVal.size()<2)
|
||||
{
|
||||
Error(ecUNEXPECTED_OPERATOR);
|
||||
}
|
||||
|
||||
token_type valTok1 = a_stVal.pop(),
|
||||
valTok2 = a_stVal.pop(),
|
||||
optTok = a_stOpt.pop(),
|
||||
|
@ -930,7 +934,7 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
|
|||
{
|
||||
if (valTok2.GetCode()!=cmVAR)
|
||||
{
|
||||
Error(ecUNEXPECTED_OPERATOR, -1, "=");
|
||||
Error(ecUNEXPECTED_OPERATOR, -1, QChar('='));
|
||||
}
|
||||
m_vRPN.AddAssignOp(valTok2.GetVar());
|
||||
}
|
||||
|
|
|
@ -266,6 +266,7 @@ int QmuParserTester::TestBinOprt()
|
|||
iStat += EqnTest ( "2*(a=b+1)", 6, true );
|
||||
iStat += EqnTest ( "(a=b+1)*2", 6, true );
|
||||
iStat += EqnTest ( "a=c; a*10", 30, true);
|
||||
iStat += EqnTest ( "a = -", 0, false ); // broken assigment
|
||||
|
||||
iStat += EqnTest ( "2^2^3", 256, true );
|
||||
iStat += EqnTest ( "1/2/3", 1.0 / 6.0, true );
|
||||
|
|
Loading…
Reference in New Issue
Block a user