From ab63dba8aab2d4ea68208dcade1a7528541f7c60 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 15 Sep 2016 18:51:51 +0200 Subject: deal with null bodys in message preview --- src/main/java/eu/siacs/conversations/utils/UIHelper.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main/java/eu/siacs') 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)) { -- cgit v1.2.3