summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 1a6302abd..3d1557c1a 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -634,10 +634,12 @@ int npc_timerevent(int tid,unsigned int tick,int id,int data)
ers_free(timer_event_ers, ted);
}
run_script(nd->u.scr.script,te->pos,nd->u.scr.rid,nd->bl.id);
- //Restore previous data.
- nd->u.scr.rid = old_rid;
- nd->u.scr.timer = old_timer;
- nd->u.scr.timertick = old_tick;
+ //Restore previous data, only if this timer is a player-attached one.
+ if (sd) {
+ nd->u.scr.rid = old_rid;
+ nd->u.scr.timer = old_timer;
+ nd->u.scr.timertick = old_tick;
+ }
return 0;
}
/*==========================================