Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when decoding unexpected road class #447

Closed
hisnhsien opened this issue Aug 21, 2020 · 5 comments · Fixed by #450
Closed

Crash when decoding unexpected road class #447

hisnhsien opened this issue Aug 21, 2020 · 5 comments · Fixed by #450
Labels
Milestone

Comments

@hisnhsien
Copy link

Today Directions crash
step:
1.build open source code .
2. run Example .
3.touch Directions .
4.Directions Crash.
image

Yesterday it worked normally.

@1ec5
Copy link
Contributor

1ec5 commented Aug 21, 2020

Thank you for reporting this issue. We’ve tracked it down to a change in the Directions API on the server side that has been rolled back.

@1ec5
Copy link
Contributor

1ec5 commented Aug 21, 2020

This probably shouldn’t be a force-unwrap:

self = RoadClasses(descriptions: descriptions)!

The initializer should be failable, not just throwing.

@1ec5 1ec5 changed the title Directions crash Crash when decoding unexpected road class Aug 21, 2020
@1ec5 1ec5 added the bug label Aug 21, 2020
@1ec5 1ec5 added this to the v1.0.0 milestone Aug 21, 2020
@1ec5
Copy link
Contributor

1ec5 commented Aug 28, 2020

The force-unwrap was added in 593efd3 for #382, which made it into v0.31.0. Previous releases wound up deserializing no road classes for any intersection that contained an unexpected road class value.

@1ec5
Copy link
Contributor

1ec5 commented Sep 2, 2020

The initializer should be failable, not just throwing.

On second thought, the approach in #450 of throwing an error is quite elegant and I don’t see a problem with it.

@1ec5 1ec5 linked a pull request Sep 2, 2020 that will close this issue
@1ec5
Copy link
Contributor

1ec5 commented Sep 2, 2020

#450 introduces the additional client-side error handling to avoid a crash in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants