Skip to content

Commit

Permalink
Fix for contrived NPE on invalid recipient during conversation compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie0 committed Jun 1, 2013
1 parent ea98fe2 commit d2a78ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<string name="ConversationActivity_group_conversation">Group Conversation</string>
<string name="ConversationActivity_d_recipients_in_group">%d recipients in group</string>
<string name="ConversationActivity_saving_draft">Saving draft...</string>
<string name="ConversationActivity_invalid_recipient">Invalid recipient!</string>

<!-- ConversationFragment -->
<string name="ConversationFragment_message_details">Message details</string>
Expand Down
6 changes: 6 additions & 0 deletions src/org/thoughtcrime/securesms/ConversationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ private void handleVerifySession() {
}

private void handleStartSecureSession() {
if (getRecipients() == null) {
Toast.makeText(this, getString(R.string.ConversationActivity_invalid_recipient),
Toast.LENGTH_LONG).show();
return;
}

final Recipient recipient = getRecipients().getPrimaryRecipient();
String recipientName = (recipient.getName() == null ? recipient.getNumber() : recipient.getName());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
Expand Down

0 comments on commit d2a78ea

Please sign in to comment.