From 759888948ea65457d9636f96909d55540946c99a Mon Sep 17 00:00:00 2001 From: Thomas Crawley Date: Thu, 19 Sep 2024 11:26:55 +0100 Subject: [PATCH] fix(cb2-11687): Fix empty adr details causing filter to break (#1595) * fix(cb2-11687): fix empty adr details * fix(cb2-11687): lint fix --- .../adr-permitted-dangerous-goods.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts index 25471d92d..601872013 100644 --- a/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts +++ b/src/app/forms/custom-sections/adr-permitted-dangerous-goods/adr-permitted-dangerous-goods.component.ts @@ -31,8 +31,9 @@ export class AdrPermittedDangerousGoodsComponent if (this.adrBodyType?.includes('battery') || this.adrBodyType?.includes('tank')) { let currentValue: string[] = this.control?.value?.value; if ( - currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_2) || - currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3) + currentValue && + (currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_2) || + currentValue.includes(ADRDangerousGood.EXPLOSIVES_TYPE_3)) ) { currentValue = currentValue.filter( (value) => value !== ADRDangerousGood.EXPLOSIVES_TYPE_3 && value !== ADRDangerousGood.EXPLOSIVES_TYPE_2