diff --git a/simutrans/ai/sqai_rail/ai.nut b/simutrans/ai/sqai_rail/ai.nut index d9e0ab7fce6..dd1c1789a77 100644 --- a/simutrans/ai/sqai_rail/ai.nut +++ b/simutrans/ai/sqai_rail/ai.nut @@ -321,9 +321,13 @@ function today_plus_months(m) function get_set_name() { local pakset = get_pakset_name() // full string from ground.outside.pak - local s = pakset.find(" ") - pakset = pakset.slice(0, s) - pakset = pakset.tolower() + if ( pakset != null ) { + local s = pakset.find(" ") + pakset = pakset.slice(0, s) + pakset = pakset.tolower() + } else { + pakset = "unknown" + } return pakset }