diff options
author | Vitaly Takmazov | 2017-09-22 17:45:57 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-09-22 17:46:34 +0300 |
commit | 702769c7f3ec2bd31a54f684ddf8e99b55b332a7 (patch) | |
tree | b845799913227edde5269a0137dee1fee6e2ee5b | |
parent | fc19da9346f5a9e20d16d572cbc94902d7bc1c51 (diff) |
api: fix NPE
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Messages.java | 5 |
1 files changed, 4 insertions, 1 deletions
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<List<com.juick.Message>> getThread( |