Skip to content

Commit

Permalink
Fix to handle invalid API directions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlindsay authored and 1ec5 committed Sep 2, 2020
1 parent 738b4cd commit 8fe8ce1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/MapboxDirections/RoadClasses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ extension RoadClasses: Codable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let descriptions = try container.decode([String].self)
self = RoadClasses(descriptions: descriptions)!
if let roadClasses = RoadClasses(descriptions: descriptions){
self = roadClasses
}
else{
throw DirectionsError.invalidResponse(nil)
}
}
}

0 comments on commit 8fe8ce1

Please sign in to comment.