mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 00:46:07 +00:00
fix divide by zero bug
This commit is contained in:
@@ -416,6 +416,16 @@ func calcDivide(o operationType, stack stack, stacklevel int) (any, ArErr) {
|
||||
true,
|
||||
}
|
||||
if typeof(resp) == "number" && typeof(output) == "number" {
|
||||
if resp.(number).Cmp(newNumber()) == 0 {
|
||||
return nil, ArErr{
|
||||
"Runtime Error",
|
||||
"Cannot divide by zero",
|
||||
o.line,
|
||||
o.path,
|
||||
o.code,
|
||||
true,
|
||||
}
|
||||
}
|
||||
output = output.(number).Quo(output.(number), resp.(number))
|
||||
return output, ArErr{}
|
||||
} else if x, ok := output.(ArObject); ok {
|
||||
|
||||
Reference in New Issue
Block a user