From 627bf18f8cfa72aee3f410f22245403ff6a98ed0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 19 May 2016 10:40:03 +0200 Subject: don't NPE on rare race condition while fetching MAM --- src/main/java/eu/siacs/conversations/entities/Message.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 225d0531..818ac1d6 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -492,6 +492,9 @@ public class Message extends AbstractEntity { Message current = this; while(current.mergeable(current.next())) { current = current.next(); + if (current == null) { + break; + } body.append(MERGE_SEPARATOR); body.append(current.getBody().trim()); } @@ -507,6 +510,9 @@ public class Message extends AbstractEntity { Message current = this; while(current.mergeable(current.next())) { current = current.next(); + if (current == null) { + break; + } status = current.status; } return status; @@ -517,6 +523,9 @@ public class Message extends AbstractEntity { Message current = this; while(current.mergeable(current.next())) { current = current.next(); + if (current == null) { + break; + } time = current.timeSent; } return time; -- cgit v1.2.3