fix: guard threadEmails.last against empty list

Add an isEmpty check before accessing threadEmails.last to prevent
StateError when emails are deleted between query and access.

Closes #341

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-06-01 17:49:54 +02:00
co-authored by Claude Sonnet 4.6
parent 968db75c69
commit dee3c32a5c
@@ -156,6 +156,7 @@ class EmailRepositoryImpl implements EmailRepository {
return;
}
if (threadEmails.isEmpty) return;
final latest = threadEmails.last;
// Collect unique participants across the whole thread.