Skip to content

Commit ec409a0

Browse files
committed
Guard AppCommandThread.guild attribute access
1 parent db42eba commit ec409a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

discord/app_commands/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def applied_tags(self) -> List[ForumTag]:
901901
def parent(self) -> Optional[Union[ForumChannel, TextChannel]]:
902902
"""Optional[Union[:class:`~discord.ForumChannel`, :class:`~discord.TextChannel`]]: The parent channel
903903
this thread belongs to."""
904-
return self.guild.get_channel(self.parent_id) # type: ignore
904+
return self.guild and self.guild.get_channel(self.parent_id) # type: ignore
905905

906906
@property
907907
def flags(self) -> ChannelFlags:
@@ -917,7 +917,7 @@ def owner(self) -> Optional[Member]:
917917
918918
.. versionadded:: 2.6
919919
"""
920-
return self.guild.get_member(self.owner_id) # type: ignore
920+
return self.guild and self.guild.get_member(self.owner_id)
921921

922922
@property
923923
def mention(self) -> str:

0 commit comments

Comments
 (0)