mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 07:48:10 +00:00
fix(core/debug): make sure return_layout_change does not crash on a race condition
[no changelog]
This commit is contained in:
parent
ed79d35de9
commit
c39ba83c8b
@ -127,10 +127,13 @@ if __debug__:
|
|||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
async def return_layout_change() -> None:
|
async def return_layout_change() -> None: # type: ignore [Return type of async generator]
|
||||||
content_tokens = await get_layout_change_content()
|
content_tokens = await get_layout_change_content()
|
||||||
|
|
||||||
assert isinstance(DEBUG_CONTEXT, context.Context)
|
# spin for a bit until DEBUG_CONTEXT becomes available
|
||||||
|
while not isinstance(DEBUG_CONTEXT, context.Context):
|
||||||
|
yield # type: ignore [Return type of async generator]
|
||||||
|
|
||||||
if storage.layout_watcher is LAYOUT_WATCHER_LAYOUT:
|
if storage.layout_watcher is LAYOUT_WATCHER_LAYOUT:
|
||||||
await DEBUG_CONTEXT.write(DebugLinkLayout(tokens=content_tokens))
|
await DEBUG_CONTEXT.write(DebugLinkLayout(tokens=content_tokens))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user