null and undefined are objects too

fixes TypeError: Cannot read properties of null (reading 'length')
This commit is contained in:
ralf 2023-04-26 09:22:30 +02:00 committed by nathan
parent 95aae678ff
commit bce396d86a

View File

@ -369,7 +369,7 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
{
return this.readonly || this.disabled ? null : (
// Give a clone of objects or receiver might use the reference
typeof this.value == "object" ? (typeof this.value.length == "undefined" ? {...this.value} : [...this.value]) : this.value
this.value && typeof this.value == "object" ? (typeof this.value.length == "undefined" ? {...this.value} : [...this.value]) : this.value
);
}