소스 검색

Fixes a potential crash when adding new maps (#5422)

* Fixes a potential crash when adding new maps
* Fixes #5396.
* Fixes a potential crash on start up when adding a map to maps_athena.conf and the map has not yet been added to map_cache.dat.
Thanks to @nubspixel!

* Inverts check
Aleos 4 년 전
부모
커밋
9eeeb09ff6
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      src/map/map.cpp

+ 3 - 0
src/map/map.cpp

@@ -3559,6 +3559,9 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
 	for(i = 0; i < header->map_count; i++) {
 	for(i = 0; i < header->map_count; i++) {
 		info = (struct map_cache_map_info *)p;
 		info = (struct map_cache_map_info *)p;
 
 
+		// name exists in maps_athena.conf but not in map_cache.dat
+		if (info->name == nullptr || info->name[0] == '\0')
+			continue;
 		if( strcmp(m->name, info->name) == 0 )
 		if( strcmp(m->name, info->name) == 0 )
 			break; // Map found
 			break; // Map found