diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-09-15 18:51:51 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-09-15 18:51:51 +0200 |
commit | ab63dba8aab2d4ea68208dcade1a7528541f7c60 (patch) | |
tree | 0807950b74b864058fa7823c5f75ea24a2cfb639 /src | |
parent | 4359afacb4a6ff52134485265b4c4a3b68542c11 (diff) |
deal with null bodys in message preview
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/UIHelper.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index c9b5ea67..bf997bc1 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -95,10 +95,6 @@ public class UIHelper { return sameDay(date,new Date(System.currentTimeMillis())); } - public static boolean sameDay(long timestamp1, long timestamp2) { - return sameDay(new Date(timestamp1),new Date(timestamp2)); - } - private static boolean sameDay(Date a, Date b) { Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); @@ -185,7 +181,9 @@ public class UIHelper { } } else { String body = message.getBody(); - if (body.length() > 256) { + if (body == null) { + body = ""; + } else if (body.length() > 256) { body = body.substring(0,256); } if (body.startsWith(Message.ME_COMMAND)) { |