Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit c84b0ef

Browse files
author
Rustam Aliyev
committed
Fix bug where message with undefined size can cause NPE
1 parent 68af1a4 commit c84b0ef

File tree

1 file changed

+7
-3
lines changed
  • modules/core/src/main/java/com/elasticinbox/core/model

1 file changed

+7
-3
lines changed

modules/core/src/main/java/com/elasticinbox/core/model/Message.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,16 @@ public void addMinorHeader(String headerName, String headerValue)
303303
public LabelCounters getLabelCounters()
304304
{
305305
LabelCounters lc = new LabelCounters();
306-
307-
lc.setTotalBytes(this.size);
306+
308307
lc.setTotalMessages(1L);
309308

310-
if(this.markers == null || !this.markers.contains(Marker.SEEN))
309+
if (this.size != null) {
310+
lc.setTotalBytes(this.size);
311+
}
312+
313+
if (this.markers == null || !this.markers.contains(Marker.SEEN)) {
311314
lc.setUnreadMessages(1L);
315+
}
312316

313317
return lc;
314318
}

0 commit comments

Comments
 (0)