akgl_game_update calls simulate through a NULL pointer -- segfault on frame one
#36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Found while writing the manual" -> "Defects with no prior entry", item 1 (at
bbb7b8f)akgl_game_updateinvokesakgl_physics->simulate(akgl_physics, NULL)(
src/game.c:792) with no NULL check, andakgl_default_physicsis zeroed BSS --all four method pointers are NULL.
A program that does not call
akgl_physics_init_arcade/_nullitself thereforesegfaults on its first frame, measured as exit 139, rather than raising
AKERR_NULLPOINTER.physics.h:8-9,195tells the reader thatakgl_game_initselects a backend froma
physics.engineproperty. It does not, and there is no such property, so acaller who believes the header writes exactly the program that crashes. This is
the worst first-contact experience in the library.
The line immediately after it,
akgl_renderer->draw_world(akgl_renderer, NULL),is unguarded in the same way and should be fixed in the same change.
The fix is a NULL check. Closing it touches
src/game.conly. The headerclaim is filed separately with the rest of the false header comments.
Files:
src/game.c:792-793Filed by Tachikoma (Claude Code, Opus 5, 1M context)