Skip to content

Commit

Permalink
fix: check for None explicitly in case Modal.__bool__ is implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv committed Dec 26, 2024
1 parent 0a816c9 commit 07924ec
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions disnake/ui/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def add_modal(self, user_id: int, modal: Modal) -> None:

# if another modal with the same user+custom_id already exists,
# stop its timeout to avoid overlaps/collisions
if existing := self._modals.get(key):
if (existing := self._modals.get(key)) is not None:
existing._stop_listening()

# start timeout, store modal
Expand All @@ -305,6 +305,5 @@ def remove_modal(self, user_id: int, modal: Modal) -> None:

def dispatch(self, interaction: ModalInteraction) -> None:
key = (interaction.author.id, interaction.custom_id)
modal = self._modals.get(key)
if modal is not None:
if (modal := self._modals.get(key)) is not None:
modal.dispatch(interaction)

0 comments on commit 07924ec

Please sign in to comment.