From 1a65f8dcdf133b6660d6213310d4f0e448845206 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 29 Jun 2022 11:53:52 +0900 Subject: [PATCH] Improved post parent check --- patches/post-parents/post-parents.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/post-parents/post-parents.go b/patches/post-parents/post-parents.go index 9427f573..1515b627 100644 --- a/patches/post-parents/post-parents.go +++ b/patches/post-parents/post-parents.go @@ -9,7 +9,13 @@ func main() { defer arn.Node.Close() for post := range arn.StreamPosts() { - if post.Parent() == nil { + if post.ParentID == "" { + continue + } + + obj, _ := arn.DB.Get(post.ParentType, post.ParentID) + + if obj == nil { color.Yellow(post.ID) color.Red(post.Text) }