fix(logger): handle empty/corrupt member log files gracefully

Return None instead of crashing when check_previous_roles finds no
parsable JSON lines in a member's log file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lowei 2026-05-22 18:25:55 +02:00
parent b3db1ef9f5
commit f570ac4fce

View file

@ -140,6 +140,10 @@ class AdvancedLogger:
except json.JSONDecodeError:
continue # Skip corrupt lines
# Guard against empty logs list after parsing
if not logs:
return None
# Find the most recent leave event
leave_events = [log for log in logs if isinstance(log, dict) and log.get("event_type") == "member_leave"]
if leave_events: