diff --git a/src/messages.ts b/src/messages.ts index edf2266..127aff2 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -26,7 +26,8 @@ const debugMessages: MessageGroup = { BRC_AUTC_MISSING_DATA: "Unable to autogenerate barcodes. Data is not a string.", BRC_BW_FORMAT_UNSUPPORTED: "This format is not supported (by Apple) for backward support. Please choose another one.", BRC_NO_POOL: "Cannot set barcode: no barcodes found. Please set barcodes first. Barcode is for retrocompatibility only.", - DATE_FORMAT_UNMATCH: "%s was not set due to incorrect date format." + DATE_FORMAT_UNMATCH: "%s was not set due to incorrect date format.", + NFC_INVALID: "Unable to set NFC properties: data not compliant with schema." }; /** diff --git a/src/pass.ts b/src/pass.ts index 6c3f9e2..62ce64b 100644 --- a/src/pass.ts +++ b/src/pass.ts @@ -442,8 +442,8 @@ export class Pass implements PassIndexSignature { return this; } - if (!(typeof data === "object" && !Array.isArray(data) && schema.isValid(data, "nfcDict"))) { - genericDebug("Invalid NFC data provided"); + if (!(data && typeof data === "object" && !Array.isArray(data) && schema.isValid(data, "nfcDict"))) { + genericDebug(formatMessage("NFC_INVALID")); return this; }