mapbox / mapbox-directions-swift

Traffic-aware directions and map matching in Swift on iOS, macOS, tvOS, watchOS, and Linux
https://www.mapbox.com/navigation/
ISC License
183 stars 89 forks source link

[🦟 Bug] Use of Directions.url(forCalculating options: DirectionsOptions, httpMethod: String) -> URL causes crash #444

Open misterkerry opened 4 years ago

misterkerry commented 4 years ago

Problem

When using this method resulting URL is normally delivered. But, on occasion the method crashes causing the App leveraging the SDK to crash.

Environment

These crashes are shown in Organizer:

Screen Shot 2020-08-11 at 6 47 59 PM

Recommendation

Line 410, 411, 413 shows 3 forced unwrapped objects that could be part of the problem: These elements can be guarded or error messages send to the App

https://github.com/mapbox/mapbox-directions-swift/blob/160e95110fe52b5f8461fbabe8d9405d16930a43/Sources/MapboxDirections/Directions.swift#L410

misterkerry commented 4 years ago

cc: @1ec5 @zugaldia

zugaldia commented 4 years ago

Thanks for the report @misterkerry - do you have any logs that may include parameter values that would help us reliably reproduce this issue?

/cc: @chezzdev

misterkerry commented 4 years ago

No problem @zugaldia . The link to the Crashlytics log above and will take a user to the logs in firebase. I would have to give access to the investigator.
I can also put a file in an access-only directory. lmk.

1ec5 commented 4 years ago

Line 410, 411, 413 shows 3 forced unwrapped objects that could be part of the problem

Force-unwrapping here essentially asserts that the URL is a well-formed URL. That most likely means something about the API hostname or query parameters is malformed.