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(); } }