fix: guard threadEmails.last against empty list #343

Merged
guettlibot merged 1 commits from issue-341-guard-threademails-last into main 2026-06-01 19:47:49 +00:00
guettlibot commented 2026-06-01 15:50:40 +00:00 (Migrated from codeberg.org)

Summary

  • Added if (threadEmails.isEmpty) return; guard before threadEmails.last in lib/data/repositories/email_repository_impl.dart
  • Prevents StateError: No element when a race condition causes emails to be deleted between query and access

Test plan

  • Code review: confirm guard is placed correctly before threadEmails.last
  • Run task check to verify CI passes

Closes #341

## Summary - Added `if (threadEmails.isEmpty) return;` guard before `threadEmails.last` in `lib/data/repositories/email_repository_impl.dart` - Prevents `StateError: No element` when a race condition causes emails to be deleted between query and access ## Test plan - [ ] Code review: confirm guard is placed correctly before `threadEmails.last` - [ ] Run `task check` to verify CI passes Closes #341
Sign in to join this conversation.