mirror of https://github.com/dirtbags/tanks.git
fix divide by zero in random
This commit is contained in:
parent
60e48c2b90
commit
575c8da393
|
@ -172,6 +172,10 @@ void
|
|||
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