From 4cb8dedbe87523475bbf589f6dc627f3c8e8f7c4 Mon Sep 17 00:00:00 2001 From: Dastgir Pojee Date: Fri, 13 Jan 2017 20:34:25 +0530 Subject: Fixes #1543 Infinite Duration status would result in error since there was no timers attached to it. Added a condition to check if status is having infinite duration and return value according to it. --- src/map/script.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index 38931bd11..eb2bd05ee 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11591,14 +11591,16 @@ BUILDIN(getstatus) case 3: script_pushint(st, sd->sc.data[id]->val3); break; case 4: script_pushint(st, sd->sc.data[id]->val4); break; case 5: - { - const struct TimerData *td = timer->get(sd->sc.data[id]->timer); + if (sd->sc.data[id]->infinite_duration) { + script_pushint(st, INFINITE_DURATION); + } else { + const struct TimerData *td = timer->get(sd->sc.data[id]->timer); - if (td != NULL) { - // return the amount of time remaining - script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + if (td != NULL) { + // return the amount of time remaining + script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + } } - } break; default: script_pushint(st, 1); break; } -- cgit v1.2.3-70-g09d2