Find why this function can trap when its record comes from external data.
swift
func regionName(
_ record: [String: String],
regions: [String]
) -> String {
let rawIndex = record["region"]!
let index = Int(rawIndex)!
return regions[index]
}