Skip to content

Fix RangeError when all SH arrays are present - #404

Open
marwie wants to merge 1 commit into
sparkjsdev:mainfrom
needle-tools:fix/sh-arrays-rangeerror
Open

Fix RangeError when all SH arrays are present#404
marwie wants to merge 1 commit into
sparkjsdev:mainfrom
needle-tools:fix/sh-arrays-rangeerror

Conversation

@marwie

@marwie marwie commented Jul 29, 2026

Copy link
Copy Markdown

SplatPager truncates the SH upload list with

shArrays.length = shArrays.findIndex((sh) => !sh);

findIndex returns -1 when no entry is missing — i.e. whenever a chunk has all SH bands (the normal case at maxSh: 3) — and setting Array.length = -1 throws RangeError: Invalid array length. On current main this breaks paged loading of any file with full SH data (not present in the released 2.1.0).

Fix: only truncate when a missing entry exists (both sites).

Repro: load a paged .rad with SH bands at default maxSh — the first chunk upload throws.

shArrays.length = findIndex(...) sets the length to -1 when no entry is
missing (all SH bands resident, e.g. maxSh 3), which throws
'Invalid array length'. Only truncate when a missing entry exists.
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