diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm index 0d44c3aa3c8..ffdb439efbc 100644 --- a/code/datums/helper_datums/map_template.dm +++ b/code/datums/helper_datums/map_template.dm @@ -51,15 +51,21 @@ // if given a multi-z template // it might need to be adapted for that when that time comes GLOB.space_manager.add_dirt(placement.z) - var/list/bounds = GLOB.maploader.load_map(get_file(), min_x, min_y, placement.z, shouldCropMap = TRUE) - if(!bounds) - return 0 - if(bot_left == null || top_right == null) - stack_trace("One of the late setup corners is bust") - - if(ST_bot_left == null || ST_top_right == null) - stack_trace("One of the smoothing corners is bust") + try + var/list/bounds = GLOB.maploader.load_map(get_file(), min_x, min_y, placement.z, shouldCropMap = TRUE) + if(!bounds) + return 0 + if(bot_left == null || top_right == null) + stack_trace("One of the late setup corners is bust") + if(ST_bot_left == null || ST_top_right == null) + stack_trace("One of the smoothing corners is bust") + catch(var/exception/e) + GLOB.space_manager.remove_dirt(placement.z) + late_setup_level(block(bot_left, top_right), block(ST_bot_left, ST_top_right)) + message_admins("Map template [name] threw an error while loading. Safe exit attempted, but check for errors at [ADMIN_COORDJMP(placement)].") + log_admin("Map template [name] threw an error while loading. Safe exit attempted.") + throw e GLOB.space_manager.remove_dirt(placement.z) late_setup_level( block(bot_left, top_right),