mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Prevent invalid context from crashing (#21231)
* Prevent invalid context from crashing * Lint
This commit is contained in:
committed by
Pascal Vizeli
parent
27d598fff8
commit
cf3a8b60ff
@@ -744,7 +744,10 @@ class State:
|
||||
|
||||
context = json_dict.get('context')
|
||||
if context:
|
||||
context = Context(**context)
|
||||
context = Context(
|
||||
id=context.get('id'),
|
||||
user_id=context.get('user_id'),
|
||||
)
|
||||
|
||||
return cls(json_dict['entity_id'], json_dict['state'],
|
||||
json_dict.get('attributes'), last_changed, last_updated,
|
||||
|
||||
Reference in New Issue
Block a user