diff --git a/apps/nspanel-lovelace-ui/luibackend/config.py b/apps/nspanel-lovelace-ui/luibackend/config.py index 9ab9dde3..326e851d 100644 --- a/apps/nspanel-lovelace-ui/luibackend/config.py +++ b/apps/nspanel-lovelace-ui/luibackend/config.py @@ -166,8 +166,10 @@ class LuiBackendConfig(object): last_card = next cur.uuid_next = next.uuid next.uuid_prev = cur.uuid - first_card.uuid_prev = last_card.uuid - last_card.uuid_next = first_card.uuid + # if there is only one top level card first and last card will be none + if first_card and last_card: + first_card.uuid_prev = last_card.uuid + last_card.uuid_next = first_card.uuid # parse screensaver self._config_screensaver = Card(self.get("screensaver")) @@ -237,4 +239,4 @@ class LuiBackendConfig(object): return self._config_cards[0] def get_card_by_uuid(self, uuid): - return self._config_card_table.get(uuid) \ No newline at end of file + return self._config_card_table.get(uuid)