diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm index 53517d5dbc9..4d6310041e5 100644 --- a/code/datums/shuttles.dm +++ b/code/datums/shuttles.dm @@ -9,8 +9,9 @@ var/admin_notes /datum/map_template/shuttle/New() - shuttle_id = "[port_id]_[suffix]" - mappath = "[prefix][shuttle_id].dmm" + if(port_id && suffix) + shuttle_id = "[port_id]_[suffix]" + mappath = "[prefix][shuttle_id].dmm" . = ..() /datum/map_template/shuttle/emergency diff --git a/code/modules/awaymissions/maploader/reader.dm b/code/modules/awaymissions/maploader/reader.dm index 7efff7cc27b..f034c4f39d1 100644 --- a/code/modules/awaymissions/maploader/reader.dm +++ b/code/modules/awaymissions/maploader/reader.dm @@ -30,6 +30,11 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new()) var/fname = "Lambda" if(isfile(tfile)) fname = "[tfile]" + // Make sure we dont load a dir up + var/lastchar = copytext(fname, -1) + if(lastchar == "/" || lastchar == "\\") + log_debug("Attempted to load map template without filename (Attempted [tfile])") + return tfile = file2text(tfile) if(!length(tfile)) throw EXCEPTION("Map path '[fname]' does not exist!") diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 5b1409af4e7..80467d19846 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -3,6 +3,7 @@ #ifdef UNIT_TESTS #include "component_tests.dm" +#include "map_templates.dm" #include "reagent_id_typos.dm" #include "spawn_humans.dm" #include "sql.dm" diff --git a/code/modules/unit_tests/map_templates.dm b/code/modules/unit_tests/map_templates.dm new file mode 100644 index 00000000000..b590526a46b --- /dev/null +++ b/code/modules/unit_tests/map_templates.dm @@ -0,0 +1,7 @@ +/datum/unit_test/map_templates/Run() + var/list/datum/map_template/templates = subtypesof(/datum/map_template) + for(var/I in templates) + var/datum/map_template/MT = new I // The new is important here to ensure stuff gets set properly + // Check if it even has a path and if so, does it exist + if(MT.mappath && !fexists(MT.mappath)) + Fail("The map file for [MT.type] does not exist!")