Skip to content

Commit

Permalink
Fix potential KeyError when removing views
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed May 30, 2021
1 parent 71b35d2 commit a433b18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def add_view(self, view: View, message_id: Optional[int] = None):
def remove_view(self, view: View):
for item in view.children:
if item.is_dispatchable():
self._views.pop((item.type.value, item.custom_id)) # type: ignore
self._views.pop((item.type.value, item.custom_id), None) # type: ignore

for key, value in self._synced_message_views.items():
if value.id == view.id:
Expand Down

0 comments on commit a433b18

Please sign in to comment.