diff --git a/neode-ui/src/utils/bitcoinReceive.ts b/neode-ui/src/utils/bitcoinReceive.ts index 71a133ef..606b02c9 100644 --- a/neode-ui/src/utils/bitcoinReceive.ts +++ b/neode-ui/src/utils/bitcoinReceive.ts @@ -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()