Skip to content

fix(android): bloom_read_file returns empty string not null on missing file + v0.4.16#62

Merged
proggeramlug merged 1 commit into
mainfrom
fix/android-read-file-null
Jun 9, 2026
Merged

fix(android): bloom_read_file returns empty string not null on missing file + v0.4.16#62
proggeramlug merged 1 commit into
mainfrom
fix/android-read-file-null

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Android bloom_read_file returned std::ptr::null() on read error. Perry treats the return as a string, so .length/.charCodeAt dereference a null StringHeader → SIGSEGV (fault addr 0xff..f8).

native/linux already returns a valid empty Perry string here (with an explanatory comment) — this is a straight parity fix.

Repro: jump's discoverLevels() probes level1..level10 + custom_* via readFile() with no fileExists guard (expects "" for missing files, as on desktop). On Android the first missing file (level6.txt) returned null → segfault on data.length immediately after tapping Play. Root-caused on-device with a numeric beacon trail; verified the fix renders Level Select + gameplay on a physical Adreno device.

Fix: Ok => alloc_perry_string(&contents), Err => alloc_perry_string(""). Bumps to v0.4.16.

…ing file

Android's bloom_read_file returned std::ptr::null() on read error. Perry treats
the *const u8 return as a string; .length/.charCodeAt then dereference a null
StringHeader and SIGSEGV (fault addr 0xff..f8). native/linux already returns a
valid empty Perry string here — this is a straight parity fix.

Repro: jump's discoverLevels() probes level1..level10 + custom_* via readFile()
without a fileExists guard (expecting '' for missing files, as on desktop). The
first missing file segfaulted the game thread right after tapping Play.

Fix: match linux — Ok => alloc_perry_string(&contents), Err => alloc_perry_string("").
@proggeramlug proggeramlug merged commit edd4376 into main Jun 9, 2026
8 checks passed
@proggeramlug proggeramlug deleted the fix/android-read-file-null branch June 9, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant