From 759a6445f0efac0fe7bd6c6238d6edd9c7e1ce3f Mon Sep 17 00:00:00 2001 From: FireMaskterK <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:58:44 +0000 Subject: [PATCH] Fix for Comment repliesPage being "null" when not present. --- .../java/me/kavin/piped/utils/ResponseHelper.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 3ef1267..a450e67 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -474,10 +474,13 @@ public class ResponseHelper { info.getRelatedItems().forEach(comment -> { try { + String repliespage = null; + if (comment.getReplies() != null) + repliespage = Constants.mapper.writeValueAsString(comment.getReplies()); + comments.add(new Comment(comment.getUploaderName(), rewriteURL(comment.getUploaderAvatarUrl()), comment.getCommentId(), comment.getCommentText(), comment.getTextualUploadDate(), - substringYouTube(comment.getUploaderUrl()), - Constants.mapper.writeValueAsString(comment.getReplies()), comment.getLikeCount(), + substringYouTube(comment.getUploaderUrl()), repliespage, comment.getLikeCount(), comment.isHeartedByUploader(), comment.isPinned(), comment.isUploaderVerified())); } catch (JsonProcessingException e) { ExceptionHandler.handle(e); @@ -508,10 +511,13 @@ public class ResponseHelper { info.getItems().forEach(comment -> { try { + String repliespage = null; + if (comment.getReplies() != null) + repliespage = Constants.mapper.writeValueAsString(comment.getReplies()); + comments.add(new Comment(comment.getUploaderName(), rewriteURL(comment.getUploaderAvatarUrl()), comment.getCommentId(), comment.getCommentText(), comment.getTextualUploadDate(), - substringYouTube(comment.getUploaderUrl()), - Constants.mapper.writeValueAsString(comment.getReplies()), comment.getLikeCount(), + substringYouTube(comment.getUploaderUrl()), repliespage, comment.getLikeCount(), comment.isHeartedByUploader(), comment.isPinned(), comment.isUploaderVerified())); } catch (JsonProcessingException e) { ExceptionHandler.handle(e);