Skip to content

Commit

Permalink
fix: add guard clause to ensure field is present before formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed Dec 16, 2024
1 parent 27a46aa commit e188350
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/modules/sgid/sgid.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e188350

Please sign in to comment.