File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
AndroidSDK/src/com/leanplum Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -306,9 +306,18 @@ public List<String> messagesIds() {
306306 try {
307307 Collections .sort (messageIds , new Comparator <String >() {
308308 @ Override
309- public int compare (String firstMessage , String secondMessage ) {
310- Date firstDate = messageForId (firstMessage ).getDeliveryTimestamp ();
311- Date secondDate = messageForId (secondMessage ).getDeliveryTimestamp ();
309+ public int compare (String firstMessageId , String secondMessageId ) {
310+ LeanplumInboxMessage firstMessage = messageForId (firstMessageId );
311+ LeanplumInboxMessage secondMessage = messageForId (secondMessageId );
312+ // Message that is null will be moved to the back of the list.
313+ if (firstMessage == null ) {
314+ return -1 ;
315+ }
316+ if (secondMessage == null ) {
317+ return 1 ;
318+ }
319+ Date firstDate = firstMessage .getDeliveryTimestamp ();
320+ Date secondDate = secondMessage .getDeliveryTimestamp ();
312321 return firstDate .compareTo (secondDate );
313322 }
314323 });
Original file line number Diff line number Diff line change @@ -149,6 +149,9 @@ public Date deliveryTimestamp() {
149149 * Returns the delivery timestamp of the newsfeed message.
150150 */
151151 public Date getDeliveryTimestamp () {
152+ if (deliveryTimestamp == null ) {
153+ return new Date ();
154+ }
152155 return new Date (deliveryTimestamp );
153156 }
154157
You can’t perform that action at this time.
0 commit comments