aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-02-22 17:25:32 +0100
committerChristian Schneppe <christian@pix-art.de>2019-02-22 17:25:32 +0100
commit9b4fcd7e1f7b721b477ac67f3ff18ebdc45de6a2 (patch)
tree6a785a8c1a10ae17d6add6a5a3511372268cb260 /src
parent2dba8c1d90163cdee265a974235d15d3a958c16f (diff)
fix some more NPE
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java24
2 files changed, 22 insertions, 15 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index d482b7326..129f5400e 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -625,10 +625,15 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private void onEditYourNameClicked(View view) {
String nick;
- if (mAccount.getDisplayName() != null) {
- nick = mAccount.getDisplayName();
- } else {
- nick = mAccount.getJid().getLocal();
+ try {
+ if (mAccount.getDisplayName() != null) {
+ nick = mAccount.getDisplayName();
+ } else {
+ nick = mAccount.getJid().getLocal();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ nick = "";
}
quickEdit(nick, R.string.your_name, value -> {
final String displayName = value.trim();
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 10eb977a7..df063bcdb 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -264,15 +264,19 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
if (Message.ERROR_MESSAGE_CANCELLED.equals(errorMessage)) {
info = getContext().getString(R.string.cancelled);
} else {
- final String[] errorParts = errorMessage.split("\\u001f", 2);
- if (errorParts.length == 2) {
- switch (errorParts[0]) {
- case "file-too-large":
- info = getContext().getString(R.string.file_too_large);
- break;
- default:
- info = getContext().getString(R.string.send_failed);
- break;
+ if (errorMessage != null) {
+ final String[] errorParts = errorMessage.split("\\u001f", 2);
+ if (errorParts.length == 2) {
+ switch (errorParts[0]) {
+ case "file-too-large":
+ info = getContext().getString(R.string.file_too_large);
+ break;
+ default:
+ info = getContext().getString(R.string.send_failed);
+ break;
+ }
+ } else {
+ info = getContext().getString(R.string.send_failed);
}
} else {
info = getContext().getString(R.string.send_failed);
@@ -1091,9 +1095,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
if (type == SENT) {
viewHolder.message_box.setBackgroundResource(activity.isDarkTheme() ? R.drawable.message_bubble_sent_dark : R.drawable.message_bubble_sent);
}
-
displayStatus(viewHolder, message, type, darkBackground);
-
return view;
}