From 12a838eb0ed8de9de73dcde1a6cd09e01806d453 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 20 Dec 2022 15:02:20 +0000 Subject: [PATCH] Don't crash trying to fetch parents we don't have --- activities/services/post.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activities/services/post.py b/activities/services/post.py index 60ddab4..bd6820a 100644 --- a/activities/services/post.py +++ b/activities/services/post.py @@ -67,6 +67,8 @@ class PostService: ancestor = self.post while ancestor.in_reply_to and len(ancestors) < num_ancestors: ancestor = cast(Post, ancestor.in_reply_to_post()) + if ancestor is None: + break if ancestor.state in [PostStates.deleted, PostStates.deleted_fanned_out]: break ancestors.append(ancestor)