fix(ui): guard receive-code index access — unblocks v1.7.91 frontend build

codeMatch[1] is string|undefined under noUncheckedIndexedAccess; using it
directly as an index into RECEIVE_CODE_MESSAGES failed vue-tsc (TS2538) and
aborted create-release.sh at the frontend build step. Bind to a const and
narrow before indexing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-06-14 04:35:21 -04:00
parent ab85827187
commit 21aaacc8b4

View File

@ -19,9 +19,9 @@ export function explainReceiveAddressFailure(error: unknown): string {
const message = error instanceof Error ? error.message : String(error || '')
// Prefer the structured reason code when present.
const codeMatch = message.match(/\[([A-Z_]+)\]/)
if (codeMatch && RECEIVE_CODE_MESSAGES[codeMatch[1]]) {
return RECEIVE_CODE_MESSAGES[codeMatch[1]]
const code = message.match(/\[([A-Z_]+)\]/)?.[1]
if (code && RECEIVE_CODE_MESSAGES[code]) {
return RECEIVE_CODE_MESSAGES[code]
}
const lower = message.toLowerCase()