Skip to content

Commit

Permalink
add protection for null status
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolivierarsenault committed Oct 29, 2023
1 parent 68295c5 commit 17d1906
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/moonraker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 17d1906

Please sign in to comment.