From 17d1906210afb3a87ff1d70aaa8aafd210514646 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):