diff --git a/deadlock_data_api/routers/v1_commands.py b/deadlock_data_api/routers/v1_commands.py index d923e4a..3906ac8 100644 --- a/deadlock_data_api/routers/v1_commands.py +++ b/deadlock_data_api/routers/v1_commands.py @@ -222,7 +222,10 @@ def next_match_generator(account_id: int) -> Generator[PlayerMatchHistoryEntry, def get_daily_matches(account_id: int) -> list[PlayerMatchHistoryEntry]: match_history = peekable(next_match_generator(account_id)) - first_match = match_history.peek() + try: + first_match = match_history.peek() + except StopIteration: + return [] # If the first match is older than 8 hours ago, we can assume that the player has no matches today if first_match.start_time < int((datetime.now() - timedelta(hours=8)).timestamp()):