[core] Fix error on invalid id extend/remove (#12064)

This commit is contained in:
Javier Peletier
2025-11-23 22:03:13 +01:00
committed by GitHub
parent a5751b294f
commit f42b806889
3 changed files with 12 additions and 0 deletions

View File

@@ -355,6 +355,8 @@ def _get_item_id(item: Any) -> str | Extend | Remove | None:
if isinstance(item_id, Extend):
# Remove instances of Extend so they don't overwrite the original item when merging:
del item[CONF_ID]
elif not isinstance(item_id, (str, Remove)):
return None
return item_id

View File

@@ -31,3 +31,9 @@ lvgl:
id: object5
x: 10
y: 11
- obj:
id:
- Invalid ID
- obj:
id:
invalid: id

View File

@@ -37,6 +37,10 @@ packages:
id: object5
x: 10
y: 11
- obj:
id: ["Invalid ID"]
- obj:
id: {"invalid": "id"}
some_component:
- id: !extend ${A}