Skip to content

QF | BadMapError: expected a map, got: nil - #3453

Open
lvachon1 wants to merge 1 commit into
mainfrom
lev/fix/stops_for_schedule_nil_route_npe
Open

QF | BadMapError: expected a map, got: nil#3453
lvachon1 wants to merge 1 commit into
mainfrom
lev/fix/stops_for_schedule_nil_route_npe

Conversation

@lvachon1

@lvachon1 lvachon1 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Scope

Asana Ticket: QF | BadMapError: expected a map, got:

Implementation

The schedule controller was encountering data where the route was unexpectedly nil. The particular code in question was updating route = route.id but route was nil. I figured that means the id is nil too. Added a unit test for this edge case.

Turns out this function is there to reformat data before it is returned via the API as JSON. One one hand, this PR solves this particular error, this request should not crash when encountering this type of data. On the other hand, if the consumer of this API data isn't expecting route to be nil/null then this just kicks the can down the road.

I'll try to find a consumer for this call and see what's what.

Update: From what I can tell this API call is only used by the stop page.

Screenshots

N/A

How to test

Unit test

…xpectedly nil. The particular code in question was updating route to be route.id but route was nil. I figured that means the id is nil too. This will likely have downstream effects, so I'll look for those next. Added a unit test for this edge case.
@lvachon1
lvachon1 requested a review from a team as a code owner August 27, 2026 15:45
@lvachon1
lvachon1 requested a review from jlucytan August 27, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant