From 6965132e5b40b5e1ff30121596c0e69c40a8aa53 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Fri, 17 Mar 2023 02:16:49 -0400 Subject: [PATCH] chuni: fix hard error caused by not having the db set up --- titles/chuni/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 13f423b..3668b29 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -32,6 +32,9 @@ class ChuniBase: def handle_get_game_charge_api_request(self, data: Dict) -> Dict: game_charge_list = self.data.static.get_enabled_charges(self.version) + + if game_charge_list is None or len(game_charge_list) == 0: + return {"length": 0, "gameChargeList": []} charges = [] for x in range(len(game_charge_list)): @@ -52,6 +55,14 @@ class ChuniBase: def handle_get_game_event_api_request(self, data: Dict) -> Dict: game_events = self.data.static.get_enabled_events(self.version) + if game_events is None or len(game_events) == 0: + self.logger.warn("No enabled events, did you run the reader?") + return { + "type": data["type"], + "length": 0, + "gameEventList": [], + } + event_list = [] for evt_row in game_events: tmp = {}