Unchecked map lookup crashes
An AI wrote this Kotlin code in an Android mobile game to look up a level's config and start it. It works for the campaign levels the dev tested, but crashes with a NullPointerException when players reach community-made or seasonal levels. What's the bug and how would you catch it?
Implement
resolve_level_track(level_ids: list[str], level_themes: list[str], soundtrack_themes: list[str], requested_id: str) → strExamples
in
[["c1","c2","s1"],["forest","cave","winter"],["forest","cave"],"c2"]out"track:cave"in
[["c1","c2","s1"],["forest","cave","winter"],["forest","cave"],"s1"]out"track:default"in
[["c1","c2","s1"],["forest","cave","winter"],["forest","cave"],"ugc-9134"]out"missing_level"What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 15 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.