Browse Source

Additional check in map_mapid2mapname (#4373)

* The mapid2name script command didn't check if the map existed (potential crash)
Atemo 5 years ago
parent
commit
78eb1bcd7b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/map/map.cpp

+ 3 - 0
src/map/map.cpp

@@ -2979,6 +2979,9 @@ const char* map_mapid2mapname(int m)
 
 	struct map_data *mapdata = map_getmapdata(m);
 
+	if (!mapdata)
+		return "";
+
 	if (mapdata->instance_id) { // Instance map check
 		struct instance_data *im = &instance_data[mapdata->instance_id];