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:
parent
b3db1ef9f5
commit
f570ac4fce
1 changed files with 9 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue