do null check before splitting error message for processing

This commit is contained in:
Daniel Gultsch 2019-02-23 10:24:08 +01:00
parent b79a2447b2
commit 24a51d8715
1 changed files with 3 additions and 1 deletions

View File

@ -222,7 +222,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
final String errorMessage = message.getErrorMessage(); final String errorMessage = message.getErrorMessage();
if (Message.ERROR_MESSAGE_CANCELLED.equals(errorMessage)) { if (Message.ERROR_MESSAGE_CANCELLED.equals(errorMessage)) {
info = getContext().getString(R.string.cancelled); info = getContext().getString(R.string.cancelled);
} else { } else if (errorMessage != null) {
final String[] errorParts = errorMessage.split("\\u001f", 2); final String[] errorParts = errorMessage.split("\\u001f", 2);
if (errorParts.length == 2) { if (errorParts.length == 2) {
switch (errorParts[0]) { switch (errorParts[0]) {
@ -236,6 +236,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else { } else {
info = getContext().getString(R.string.send_failed); info = getContext().getString(R.string.send_failed);
} }
} else {
info = getContext().getString(R.string.send_failed);
} }
error = true; error = true;
break; break;