fix(highway_3d): make _bgPanelKey throw-safe on panelIndexFor

Follow-up to the _bgPanelKey alias fix: _freeCamFor already treats
panelIndexFor as potentially throwy and catches to keep framing stable, but
_bgPanelKey called it bare. A throwing splitscreen build would take down
background-settings resolution (and the render path) even though the camera
path falls back safely. Wrap the call in try/catch, falling back to 'main'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Kris Anderson <topkoa@gmail.com>
This commit is contained in:
Kris Anderson
2026-07-09 16:21:14 -04:00
co-authored by Claude Opus 4.8
parent 0d4d8229c7
commit a6a5186180
+7 -3
View File
@@ -2596,10 +2596,14 @@
const FRET_NUMBER_GHOST_SCOPE_IDS = ['chords', 'all'];
function _bgPanelKey(canvas) {
// Defensive on the splitscreen global name (rename in flight) so per-panel
// background settings keep resolving the same panel as _freeCamFor().
// Defensive on the splitscreen global name (rename in flight) AND throw-safe
// on panelIndexFor — same as _freeCamFor — so a misbehaving splitscreen
// build can't take down background-settings resolution. Falls back to 'main'.
const ss = window.feedBackSplitscreen || window.slopsmithSplitscreen;
const idx = (ss && typeof ss.panelIndexFor === 'function') ? ss.panelIndexFor(canvas) : null;
let idx = null;
if (ss && typeof ss.panelIndexFor === 'function') {
try { idx = ss.panelIndexFor(canvas); } catch (e) { idx = null; }
}
return (idx == null) ? 'main' : 'panel' + idx;
}