Skip to content

Commit

Permalink
refactor: handle empty case
Browse files Browse the repository at this point in the history
Signed-off-by: joshuaunity <[email protected]>
  • Loading branch information
joshuaunity committed Oct 2, 2024
1 parent 73f3b61 commit 0191b79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flexmeasures/utils/coding_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ def process_sensors(asset) -> list[dict[str, "Sensor"]]: # noqa F821
old_sensors_to_show = (
asset.sensors_to_show
) # Used to check if sensors_to_show was updated
asset.sensors_to_show = asset.attributes.get("sensors_to_show", [])
if asset.attributes is not None:
asset.sensors_to_show = asset.attributes.get("sensors_to_show", [])
else:
asset.sensors_to_show = []

if not asset.sensors_to_show or asset.sensors_to_show == {}:
sensors_to_show = asset.sensors[:2]
if (
Expand Down

0 comments on commit 0191b79

Please sign in to comment.