Ignore single comment parsing error.

This commit is contained in:
Docile-Alligator
2025-04-08 10:14:24 -04:00
parent 2d63c6da69
commit d4adf6bd4e

View File

@ -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();
}
}
}