mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Added checks for divisiou and modulo by zero
This commit is contained in:
parent
b78f74a3f4
commit
b8d15838c5
1 changed files with 10 additions and 0 deletions
|
@ -382,9 +382,19 @@ bool parseExpression(char* infix, DebugInterface* cpu, u32& dest)
|
|||
valueStack.push_back(arg[1]*arg[0]);
|
||||
break;
|
||||
case EXOP_DIV: // a/b
|
||||
if (arg[0] == 0)
|
||||
{
|
||||
sprintf(expressionError,"Division by zero");
|
||||
return false;
|
||||
}
|
||||
valueStack.push_back(arg[1]/arg[0]);
|
||||
break;
|
||||
case EXOP_MOD: // a%b
|
||||
if (arg[0] == 0)
|
||||
{
|
||||
sprintf(expressionError,"Modulo by zero");
|
||||
return false;
|
||||
}
|
||||
valueStack.push_back(arg[1]%arg[0]);
|
||||
break;
|
||||
case EXOP_ADD: // a+b
|
||||
|
|
Loading…
Add table
Reference in a new issue