aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-09-17 11:16:07 +0200
committerChristian Schneppe <christian@pix-art.de>2016-09-17 11:16:07 +0200
commit93552c34f80607b70bed64d5d626575c007823fd (patch)
tree45b0fb74d023a3f59513c28c6604fb79a0cfa4a5 /src/main/java/de/pixart/messenger
parentc3f3f662592fda629d5eea625a387b04f666bc92 (diff)
deal with null bodys in message preview
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index 7175b381e..7e2d46018 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -94,10 +94,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();
@@ -184,10 +180,12 @@ public class UIHelper {
}
} else {
String body = message.getBody();
- if (body.length() > 256) {
- body = body.substring(0,256);
- }
- if (body.startsWith(Message.ME_COMMAND)) {
+ if (body == null) {
+ body = "";
+ } else if (body.length() > 256) {
+ body = body.substring(0, 256);
+ }
+ if (body.startsWith(Message.ME_COMMAND)) {
return new Pair<>(body.replaceAll("^" + Message.ME_COMMAND,
UIHelper.getMessageDisplayName(message) + " "), false);
} else if (GeoHelper.isGeoUri(message.getBody())) {