mirror of https://github.com/dirtbags/tanks.git
fix divide by zero in random
This commit is contained in:
parent
60e48c2b90
commit
575c8da393
|
@ -173,6 +173,10 @@ forf_proc_random(struct forf_env *env)
|
|||
{
|
||||
long max = forf_pop_num(env);
|
||||
|
||||
if (max < 1) {
|
||||
forf_push_num(env, 0);
|
||||
}
|
||||
|
||||
forf_push_num(env, rand() % max);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue