summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-18 21:57:33 +0200
committerHaru <haru@dotalux.com>2015-08-18 21:57:33 +0200
commita9042bf0bee2d2453058b22973bea8f335c5a201 (patch)
treee92d9e43a5b88197557f4430bc42a8e6ff27b9b3
parenteaca495cf99c2311bfa9ecc458f43551b511b6ed (diff)
downloadhercules-a9042bf0bee2d2453058b22973bea8f335c5a201.tar.gz
hercules-a9042bf0bee2d2453058b22973bea8f335c5a201.tar.bz2
hercules-a9042bf0bee2d2453058b22973bea8f335c5a201.tar.xz
hercules-a9042bf0bee2d2453058b22973bea8f335c5a201.zip
Fixed a qiget/qicheck crash in queue iterators
- Fixes #652 - Follow-up to 918b1123963ac2f91a4d074b092ceef1db71b4e8 - Thanks to Dastgir, Andrei Karas Signed-off-by: Haru <haru@dotalux.com>
-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 cbbf306d1..efce0b986 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19091,7 +19091,7 @@ BUILDIN(qiget) {
if( idx < 0 || idx >= script->hqis ) {
ShowWarning("buildin_qiget: unknown queue iterator id %d\n",idx);
script_pushint(st, 0);
- } else if ( script->hqi[idx].pos -1 == script->hqi[idx].items ) {
+ } else if (script->hqi[idx].pos >= script->hqi[idx].items) {
script_pushint(st, 0);
} else {
struct hQueueIterator *it = &script->hqi[idx];
@@ -19108,7 +19108,7 @@ BUILDIN(qicheck) {
if( idx < 0 || idx >= script->hqis ) {
ShowWarning("buildin_qicheck: unknown queue iterator id %d\n",idx);
script_pushint(st, 0);
- } else if ( script->hqi[idx].pos -1 == script->hqi[idx].items ) {
+ } else if (script->hqi[idx].pos >= script->hqi[idx].items) {
script_pushint(st, 0);
} else {
script_pushint(st, 1);