From e188350b6b5e668087e294c6f417845c71f9fbe8 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 16 Dec 2024 11:56:24 +0800 Subject: [PATCH] fix: add guard clause to ensure field is present before formatting --- src/app/modules/sgid/sgid.adapter.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/modules/sgid/sgid.adapter.ts b/src/app/modules/sgid/sgid.adapter.ts index 332d6fae7f..fddcaaa475 100644 --- a/src/app/modules/sgid/sgid.adapter.ts +++ b/src/app/modules/sgid/sgid.adapter.ts @@ -161,6 +161,12 @@ export class SGIDMyInfoData */ _formatFieldValue(attr: ExternalAttr): string | undefined { const fieldValue = this.#payload[attr] + // returned payload might be empty if the form fields were edited after the initial scope sent to sgid + // sgid would then respond only the data initially requested + // but the form now expects more fields + if (!fieldValue) { + return '' + } switch (attr) { case ExternalAttr.RegisteredAddress: return formatAddress(fieldValue)