some code clean up to fix some rare NPE’s

This commit is contained in:
Daniel Gultsch 2015-04-19 19:11:32 +02:00
parent 570a22206d
commit 9e20a4936e
2 changed files with 7 additions and 4 deletions

View File

@ -929,10 +929,10 @@ public class ConversationActivity extends XmppActivity
} }
private void handleViewConversationIntent(final Intent intent) { private void handleViewConversationIntent(final Intent intent) {
final String uuid = (String) intent.getExtras().get(CONVERSATION); final String uuid = intent.getStringExtra(CONVERSATION);
final String downloadUuid = (String) intent.getExtras().get(MESSAGE); final String downloadUuid = intent.getStringExtra(MESSAGE);
final String text = intent.getExtras().getString(TEXT, ""); final String text = intent.getStringExtra(TEXT);
final String nick = intent.getExtras().getString(NICK, null); final String nick = intent.getStringExtra(NICK);
if (selectConversationByUuid(uuid)) { if (selectConversationByUuid(uuid)) {
this.mConversationFragment.reInit(getSelectedConversation()); this.mConversationFragment.reInit(getSelectedConversation());
if (nick != null) { if (nick != null) {

View File

@ -1019,6 +1019,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} }
public void appendText(String text) { public void appendText(String text) {
if (text == null) {
return;
}
String previous = this.mEditMessage.getText().toString(); String previous = this.mEditMessage.getText().toString();
if (previous.length() != 0 && !previous.endsWith(" ")) { if (previous.length() != 0 && !previous.endsWith(" ")) {
text = " " + text; text = " " + text;