From 702769c7f3ec2bd31a54f684ddf8e99b55b332a7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 22 Sep 2017 17:45:57 +0300 Subject: api: fix NPE --- juick-api/src/main/java/com/juick/api/controllers/Messages.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'juick-api/src/main/java/com') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index 3037f3a1..322effa3 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -139,7 +139,10 @@ public class Messages { @RequestParam(required = false) Long before ) { User visitor = UserUtils.getCurrentUser(); - return ResponseEntity.ok(messagesService.getNotifications(visitor, LocalDateTime.ofInstant(Instant.ofEpochMilli(before), ZoneId.systemDefault()))); + LocalDateTime beforeTime = before != null ? + LocalDateTime.ofInstant(Instant.ofEpochMilli(before), ZoneId.systemDefault()) + : null; + return ResponseEntity.ok(messagesService.getNotifications(visitor, beforeTime)); } @RequestMapping("/thread") public ResponseEntity> getThread( -- cgit v1.2.3