summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2008-10-27 17:55:23 +0000
committerJared Adams <jaxad0127@gmail.com>2008-10-27 17:55:23 +0000
commit10092dd0bba68c903784bea3e527bdc07f5e5318 (patch)
tree12583ce87485e6c5eb6beb9414df32d516b1cb2a /src/map/script.c
parent90735f447e12393f3d89b8c053bd4d8c8a707fa2 (diff)
downloadtmwa-10092dd0bba68c903784bea3e527bdc07f5e5318.tar.gz
tmwa-10092dd0bba68c903784bea3e527bdc07f5e5318.tar.bz2
tmwa-10092dd0bba68c903784bea3e527bdc07f5e5318.tar.xz
tmwa-10092dd0bba68c903784bea3e527bdc07f5e5318.zip
Commit Mantis 518: Monster Oil quest crashes server
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 251ce01..9e476c0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1695,10 +1695,10 @@ int buildin_rand(struct script_state *st)
max=tmp;
}
range=max-min+1;
- push_val(st->stack,C_INT,rand()%range+min);
+ push_val(st->stack,C_INT,(range <= 0 ? 0 : rand()%range) + min);
} else {
range=conv_num(st,& (st->stack->stack_data[st->start+2]));
- push_val(st->stack,C_INT,rand()%range);
+ push_val(st->stack,C_INT,range <= 0 ? 0 : rand()%range);
}
return 0;
}