Code Room
Vibe codingMedium
Question
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?
fun startLevel(id: String) { val config = levelConfigs[id]!! // map lookup, force non-null val music = soundtracks[config.themeId]!! // nested lookup audio.play(music) engine.load(config)}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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.