From 35789a3d34bb8bfbcbee9ce05d909e2a771adf24 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Sun, 30 Jun 2019 02:10:12 +0200 Subject: [PATCH] Added NFC_INVALID message --- src/messages.ts | 3 ++- src/pass.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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; }