deal with null bodys in message preview

This commit is contained in:
Daniel Gultsch 2016-09-15 18:51:51 +02:00
parent 4359afacb4
commit ab63dba8aa

View file

@ -95,10 +95,6 @@ public class UIHelper {
return sameDay(date,new Date(System.currentTimeMillis())); 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) { private static boolean sameDay(Date a, Date b) {
Calendar cal1 = Calendar.getInstance(); Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance();
@ -185,7 +181,9 @@ public class UIHelper {
} }
} else { } else {
String body = message.getBody(); String body = message.getBody();
if (body.length() > 256) { if (body == null) {
body = "";
} else if (body.length() > 256) {
body = body.substring(0,256); body = body.substring(0,256);
} }
if (body.startsWith(Message.ME_COMMAND)) { if (body.startsWith(Message.ME_COMMAND)) {