Explorar o código

Fixed a potential crash on change map events (#3699)

* Fixes #3687.
* When changing to an unknown map (or one on another map-server) the instance checks attempted to check null data.
Thanks to @lelouch22!
Aleos %!s(int64=6) %!d(string=hai) anos
pai
achega
505a0cd888
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/map/pc.cpp

+ 1 - 1
src/map/pc.cpp

@@ -5502,7 +5502,7 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
 	sd->state.workinprogress = WIP_DISABLE_NONE;
 
 	if( sd->state.changemap ) { // Misc map-changing settings
-		unsigned short curr_map_instance_id = map_getmapdata(sd->bl.m)->instance_id, new_map_instance_id = mapdata->instance_id;
+		unsigned short curr_map_instance_id = map_getmapdata(sd->bl.m)->instance_id, new_map_instance_id = (mapdata ? mapdata->instance_id : 0);
 
 		if (curr_map_instance_id != new_map_instance_id) {
 			if (curr_map_instance_id) // Update instance timer for the map on leave