Guard against unknown entities in automation compare functions (#25213)

Guard against unknown entities
This commit is contained in:
Simon Lamon 2025-04-29 07:24:49 +02:00 committed by GitHub
parent f65a0ef4f7
commit 0242fbc6f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,10 +167,18 @@ const compareEntityIdWithEntityRegId = (
return false;
}
if (entityIdA.includes(".")) {
entityIdA = entityRegistryByEntityId(entityRegistry)[entityIdA].id;
const entityA = entityRegistryByEntityId(entityRegistry)[entityIdA];
if (!entityA) {
return false;
}
entityIdA = entityA.id;
}
if (entityIdB.includes(".")) {
entityIdB = entityRegistryByEntityId(entityRegistry)[entityIdB].id;
const entityB = entityRegistryByEntityId(entityRegistry)[entityIdB];
if (!entityB) {
return false;
}
entityIdB = entityB.id;
}
return entityIdA === entityIdB;
};