Browse code

BM-15000 Chore: toString() NPE

Thomas Cataldo authored on 28/06/2019 08:55:51
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@ import java.util.Collection;
26 26
 import java.util.Collections;
27 27
 import java.util.EnumSet;
28 28
 import java.util.List;
29
+import java.util.Optional;
29 30
 
30 31
 import net.bluemind.backend.mail.api.MessageBody.Part;
31 32
 import net.bluemind.core.api.BMApi;
... ...
@@ -111,6 +112,7 @@ public class MailboxItem {
111 112
 
112 113
 	@Override
113 114
 	public String toString() {
114
-		return "[rec imap: " + imapUid + ", body: " + body.guid + ", flags: " + systemFlags + "]";
115
+		return "[rec imap: " + imapUid + ", body: " + Optional.ofNullable(body).map(b -> b.guid).orElse("NULL BODY")
116
+				+ ", flags: " + systemFlags + "]";
115 117
 	}
116 118
 }