瀏覽代碼

Fixed unit_teleport_timer not removing an unnecessary timer - http://rathena.org/board/tracker/issue-8174-map-server-crash/

Akinari1087 11 年之前
父節點
當前提交
d9afca6d91
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/map/unit.c

+ 3 - 1
src/map/unit.c

@@ -147,7 +147,7 @@ int unit_teleport_timer(int tid, unsigned int tick, int id, intptr_t data){
 
 	if(tid == INVALID_TIMER || mast_tid == NULL)
 		return 0;
-	else if(*mast_tid != tid)
+	else if(*mast_tid != tid || bl == NULL)
 		return 0;
 	else {
 		TBL_PC *msd = unit_get_master(bl);
@@ -155,6 +155,8 @@ int unit_teleport_timer(int tid, unsigned int tick, int id, intptr_t data){
 			*mast_tid = INVALID_TIMER;
 			unit_warp(bl, msd->bl.id, msd->bl.x, msd->bl.y, CLR_TELEPORT );
 		}
+		else // No timer needed
+			*mast_tid = INVALID_TIMER;
 	}
 	return 0;
 }