1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28: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:
matejcik 2024-08-05 15:47:17 +02:00 committed by matejcik
parent ed79d35de9
commit c39ba83c8b

View File

@ -127,10 +127,13 @@ if __debug__:
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()
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:
await DEBUG_CONTEXT.write(DebugLinkLayout(tokens=content_tokens))
else: