Skip to content

Commit e9ba510

Browse files
committed
Properly handle keys not included in response
1 parent 560254b commit e9ba510

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

TCAT/Model/Direction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class Direction: NSObject, NSCopying, Codable {
105105
do { routeNumber = try container.decode(Int.self, forKey: .routeNumber) } catch { routeNumber = -1 }
106106
stops = try! container.decode([LocationObject].self, forKey: .stops)
107107
do { stayOnBusForTransfer = try container.decode(Bool.self, forKey: .stayOnBusForTransfer) } catch { stayOnBusForTransfer = false }
108-
tripIdentifiers = try! container.decode([String]?.self, forKey: .tripIdentifiers)
109-
delay = try! container.decode(Int?.self, forKey: .delay)
108+
tripIdentifiers = try? container.decode([String].self, forKey: .tripIdentifiers)
109+
delay = try? container.decode(Int.self, forKey: .delay)
110110
travelDistance = try! container.decode(Double.self, forKey: .travelDistance)
111111
super.init()
112112
}

0 commit comments

Comments
 (0)