Don't crash trying to fetch parents we don't have
This commit is contained in:
parent
d1e398a7b7
commit
12a838eb0e
|
@ -67,6 +67,8 @@ class PostService:
|
||||||
ancestor = self.post
|
ancestor = self.post
|
||||||
while ancestor.in_reply_to and len(ancestors) < num_ancestors:
|
while ancestor.in_reply_to and len(ancestors) < num_ancestors:
|
||||||
ancestor = cast(Post, ancestor.in_reply_to_post())
|
ancestor = cast(Post, ancestor.in_reply_to_post())
|
||||||
|
if ancestor is None:
|
||||||
|
break
|
||||||
if ancestor.state in [PostStates.deleted, PostStates.deleted_fanned_out]:
|
if ancestor.state in [PostStates.deleted, PostStates.deleted_fanned_out]:
|
||||||
break
|
break
|
||||||
ancestors.append(ancestor)
|
ancestors.append(ancestor)
|
||||||
|
|
Loading…
Reference in New Issue