Skip the null holes that remove() and single player leave behind - #79
Open
darmie wants to merge 1 commit into
Open
Skip the null holes that remove() and single player leave behind#79darmie wants to merge 1 commit into
darmie wants to merge 1 commit into
Conversation
boundingSearch reads objects[surfIdx].object, but remove() nulls that slot
and keeps the index ("Preserve indices pls"), so a cell can name a null one.
build() skips those holes when walking the same array; this loop did not.
formatGemHuntCounter reads playerList[0].us, but playerList is only populated
in multiplayer: initPlayerList() is gated on isMultiplayer and addPlayer()
needs playerListCtrl. Single player leaves it empty.
Neither crashes -- System.hl.hx catches per frame -- so the game stops
rendering and keeps throwing. On a Gem Hunt level: ~198k throws/40s from the
broadphase, ~250k/30s from the counter, both to zero with these guards.
darmie
force-pushed
the
fix/null-guards-in-broadphase-and-hunt-counter
branch
from
September 4, 2026 15:23
fed71b4 to
e979c4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two unguarded reads that throw
Null accessevery frame. In both cases the surrounding code already checks the same condition elsewhere.GridBroadphase.boundingSearch—remove()nullsobjects[proxy.index]and keeps the index (// Preserve indices pls), so a cell can name a null slot.build()skips those holes when walking the same array; this loop doesn't.PlayGui.formatGemHuntCounter—playerListis only populated in multiplayer:initPlayerList()is gated onisMultiplayer,addPlayer()needsplayerListCtrl != null. Single player leaves it empty, soplayerList[0].usderefs null on every restart.Neither crashes —
System.hl.hxcatches per frame, so the game stops rendering and keeps throwing.Measured on a Gem Hunt level: ~198k throws/40s from the broadphase, ~250k/30s from the counter, both to zero with these guards.