From 099f0b697f62d58947ad5ef951dedc27058e9d0f Mon Sep 17 00:00:00 2001 From: Marc-Olivier Arsenault Date: Sun, 29 Oct 2023 21:13:41 +0000 Subject: [PATCH] add protection for null status --- custom_components/moonraker/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/moonraker/__init__.py b/custom_components/moonraker/__init__.py index ece4454..f183963 100755 --- a/custom_components/moonraker/__init__.py +++ b/custom_components/moonraker/__init__.py @@ -124,9 +124,11 @@ async def _gcode_file_detail_updater(coordinator): data = await coordinator._async_fetch_data( METHODS.PRINTER_OBJECTS_QUERY, coordinator.query_obj ) - return await coordinator._async_get_gcode_file_detail( - data["status"]["print_stats"]["filename"] - ) + filename = "" + if "status" in data: + filename = data["status"]["print_stats"]["filename"] + + return await coordinator._async_get_gcode_file_detail(filename) class MoonrakerDataUpdateCoordinator(DataUpdateCoordinator):