- Set<Reply> replies = sone.getReplies();
- final Map<Post, List<Reply>> repliedPosts = new HashMap<Post, List<Reply>>();
- for (Reply reply : replies) {
- Post post = reply.getPost();
- if (repliedPosts.containsKey(post) || sone.equals(post.getSone()) || (sone.equals(post.getRecipient()))) {
+ Set<PostReply> replies = sone.get().getReplies();
+ final Map<Post, List<PostReply>> repliedPosts = new HashMap<Post, List<PostReply>>();
+ for (PostReply reply : replies) {
+ Optional<Post> post = reply.getPost();
+ if (!post.isPresent() || repliedPosts.containsKey(post.get()) || sone.get().equals(post.get().getSone()) || (sone.get().getId().equals(post.get().getRecipientId().orNull()))) {