From 9eeeb09ff61e84ab10935af905bc0a340f21e1ed Mon Sep 17 00:00:00 2001 From: Aleos Date: Sun, 29 Nov 2020 22:01:17 -0500 Subject: [PATCH] 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 --- src/map/map.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/map/map.cpp b/src/map/map.cpp index a786168e0d..6c53d1028d 100644 --- a/src/map/map.cpp +++ b/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++) { 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 ) break; // Map found