ensures map templates don't kill server (#19690)

This commit is contained in:
S34N
2022-11-16 21:14:13 +01:00
committed by GitHub
parent 4477cc7438
commit 9d27ebea75
+14 -8
View File
@@ -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),