diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java index 760babc3..f2a2213a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/ParseComment.java @@ -19,8 +19,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.Executor; -import ml.docilealligator.infinityforreddit.thing.MediaMetadata; import ml.docilealligator.infinityforreddit.commentfilter.CommentFilter; +import ml.docilealligator.infinityforreddit.thing.MediaMetadata; import ml.docilealligator.infinityforreddit.utils.JSONUtils; import ml.docilealligator.infinityforreddit.utils.Utils; @@ -110,17 +110,22 @@ public class ParseComment { } } } else { - Comment comment = parseSingleComment(childData, 0); - String parentFullName = comment.getParentId(); + try { + Comment comment = parseSingleComment(childData, 0); + String parentFullName = comment.getParentId(); - Comment parentComment = findCommentByFullName(newComments, parentFullName); - if (parentComment != null) { - parentComment.setHasReply(true); - parentComment.addChild(comment, parentComment.getChildCount()); - parentComment.setChildCount(parentComment.getChildCount() + 1); - } else { - // assume that it is parent of this call - newComments.add(comment); + Comment parentComment = findCommentByFullName(newComments, parentFullName); + if (parentComment != null) { + parentComment.setHasReply(true); + parentComment.addChild(comment, parentComment.getChildCount()); + parentComment.setChildCount(parentComment.getChildCount() + 1); + } else { + // assume that it is parent of this call + newComments.add(comment); + } + } catch (JSONException e) { + // Well we need to catch and ignore the exception to not show "error loading comments" to users + e.printStackTrace(); } } }