From 9c3bf2063b280883c532912c3f37dcc27d824ee0 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Tue, 23 Feb 2021 11:28:07 +0200 Subject: [PATCH] Lwm2m: front fix bug: config profile -> add object if list empty --- .../profile/device/lwm2m/lwm2m-object-list.component.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts index 12be3af48c..f760c56828 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts @@ -134,7 +134,7 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V } private add(object: ObjectLwM2M): void { - if (this.modelValue.indexOf(object.id) === -1) { + if (isDefinedAndNotNull(this.modelValue) && this.modelValue.indexOf(object.id) === -1) { this.modelValue.push(object.id); this.objectsList.push(object); this.lwm2mListFormGroup.get('objectsList').setValue(this.objectsList); @@ -151,9 +151,6 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V index = this.modelValue.indexOf(object.id); this.modelValue.splice(index, 1); this.removeList.next(object); - if (!this.modelValue.length) { - this.modelValue = null; - } this.clear(); } }