summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-23 10:34:08 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-23 10:34:08 +0000
commit44e6bd5d396dd89cb6d5981d6dc3eee14df1e945 (patch)
treef14a4d1ff7884610f129c3c0a76d1bcec24f1876 /src
parent2261e2fb2477d33cb9c8cb6de79a7fc69ca63bb3 (diff)
downloadhercules-44e6bd5d396dd89cb6d5981d6dc3eee14df1e945.tar.gz
hercules-44e6bd5d396dd89cb6d5981d6dc3eee14df1e945.tar.bz2
hercules-44e6bd5d396dd89cb6d5981d6dc3eee14df1e945.tar.xz
hercules-44e6bd5d396dd89cb6d5981d6dc3eee14df1e945.zip
Crash prevention
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6706 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 5f1b72f82..72e0935dd 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11412,14 +11412,14 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
// let's run that stuff
run_script_main(st);
- if(st->sleep.tick > 0) {
- // スタック情報をsleep_dbに保存
- unsigned int tick = gettick()+st->sleep.tick;
- st->sleep.charid = sd ? sd->char_id : 0;
- st->sleep.timer = add_timer(tick, run_script_timer, st->sleep.charid, (int)st);
- linkdb_insert(&sleep_db, (void*)st->oid, st);
- } else {
- if (st->state != END && sd) {
+ if(st){
+ if(st->sleep.tick > 0) {
+ // スタック情報をsleep_dbに保存
+ unsigned int tick = gettick()+st->sleep.tick;
+ st->sleep.charid = sd ? sd->char_id : 0;
+ st->sleep.timer = add_timer(tick, run_script_timer, st->sleep.charid, (int)st);
+ linkdb_insert(&sleep_db, (void*)st->oid, st);
+ } else if (sd) {
// script is not finished, store data in sd.
sd->npc_script = st->script;
sd->npc_scriptroot = rootscript;
@@ -11427,23 +11427,23 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
sd->stack = st->stack;
if (bck_stack) //Get rid of the backup as it can't be restored.
script_free_stack (bck_stack);
- } else {
- // and if there was a sd associated - zero vars.
- if (sd) {
- //Clear or restore previous script.
- sd->npc_script = bck_script;
- sd->npc_scriptroot = bck_scriptroot;
- sd->npc_scriptstate = bck_scriptstate;
- sd->stack = bck_stack;
- //Since the script is done, save any changed account variables [Skotlex]
- if (sd->state.reg_dirty&2)
- intif_saveregistry(sd,2);
- if (sd->state.reg_dirty&1)
- intif_saveregistry(sd,1);
- }
- //aFree(st);
- return 0;
}
+ } else {
+ // and if there was a sd associated - zero vars.
+ if (sd) {
+ //Clear or restore previous script.
+ sd->npc_script = bck_script;
+ sd->npc_scriptroot = bck_scriptroot;
+ sd->npc_scriptstate = bck_scriptstate;
+ sd->stack = bck_stack;
+ //Since the script is done, save any changed account variables [Skotlex]
+ if (sd->state.reg_dirty&2)
+ intif_saveregistry(sd,2);
+ if (sd->state.reg_dirty&1)
+ intif_saveregistry(sd,1);
+ }
+ //aFree(st);
+ return 0;
}
return st->pos;