Fix RangeError in picman.ts array-length crash
Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Click a segment to jump to that moment
7msession
0interventions
by library · 1d
GOAL
Debug and fix a crash in a terminal picman game caused by a negative array length, then check whether other games in the extension set had the same bug and commit the fix.
- +0Prompt · +0I got an array length error in picman
- +0mAgent did · +0mFound that Array(s.lives) throws when lives hits 0 or negative; wrapped it in Math.max(0, s.lives) in picman.ts and applied the edit.
- +1mPrompt · +1mDo we have this issue in any other game?
- +1mAgent did · +1mGrepped all extension files for similar Array()/.repeat() patterns; confirmed every other game (badlogic-game, ping, snake, spice-invaders, tetris) already guards padding/array sizes with Math.max(0, ...), so picman was the only unprotected case.
- +5mPrompt · +5mFine. commit/push
- +5mFail · +5mgit add/commit/push failed: picman.ts pathspec didn't match, and the file wasn't even present at the expected extensions directory.
- +6mAgent did · +6mSearched the filesystem, found the real file at pi-extensions/arcade/picman.ts, verified the Math.max fix was already present there and already committed (commit 78ec2b4), with no diff against HEAD.
- +7mOutcome · +7mNo new commit needed — fix already existed in the repo at arcade/picman.ts; crash was from a stale installed extension version, not an uncommitted change.
VERDICT
Next time I'd point the agent straight at the actual repo path instead of the installed extensions directory, since the crash was from a stale build that no longer matched my source. The check across other games was useful and quick, but the whole commit/push step was wasted effort chasing the wrong file location — I should have told it where the real source lived up front.