Fix for contrived NPE on invalid recipient during conversation compose.

This commit is contained in:
Moxie Marlinspike 2013-06-01 12:42:21 -07:00
parent ea98fe2d4f
commit d2a78ea84c
2 changed files with 7 additions and 0 deletions

View file

@ -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>

View file

@ -300,6 +300,12 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
}
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);