Skip to content

ConversationDetailProvider.conversation - No valid conversation crash#4536

Open
aaravgarg wants to merge 1 commit intomainfrom
fix/ios-crash-conversation-detail-no-conversation
Open

ConversationDetailProvider.conversation - No valid conversation crash#4536
aaravgarg wants to merge 1 commit intomainfrom
fix/ios-crash-conversation-detail-no-conversation

Conversation

@aaravgarg
Copy link
Collaborator

Summary

  • Add conversationOrNull getter that returns null instead of throwing StateError
  • Add hasConversation convenience getter for safe existence checks
  • The existing conversation getter still throws for callers that expect non-null, but callers can now safely check first
  • Prevents crash when navigating to conversation detail for a date with no conversations

Crash Stats

Test plan

  • Verify conversation detail page still works normally
  • Test navigating to a date with no conversations (should handle gracefully)

🤖 Generated with Claude Code

Extract nullable conversation lookup into conversationOrNull getter
so callers can safely check for conversation existence before accessing
it. Add hasConversation convenience getter.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@aaravgarg aaravgarg requested a review from mdmohsin7 February 1, 2026 23:19
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a crash that occurs when no conversation is available for a selected date. The changes in ConversationDetailProvider are well-designed: renaming the conversation getter to conversationOrNull and making it return null instead of throwing an error is a good pattern. The addition of the hasConversation getter provides a convenient and safe way for UI components to check for the existence of a conversation before attempting to access it. Preserving the original throwing behavior in the conversation getter ensures backward compatibility for existing code that relies on a non-null return value. The implementation is clean and directly solves the reported issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant