Safe display name parse

This commit is contained in:
Yegor Vialov 2020-05-08 12:55:44 +00:00
parent 870bc25dd9
commit cffac8e1f8

View File

@ -79,7 +79,8 @@ class Entity {
);
String get displayName =>
attributes["friendly_name"] ?? (attributes["name"] ?? entityId.split(".")[1].replaceAll("_", " "));
attributes["friendly_name"] ??
(attributes["name"] ?? (entityId != null && entityId.contains('.')) ? entityId.split(".")[1].replaceAll("_", " ") : "");
bool get isView =>
(domain == "group") &&