From a433b18b31ac5fbe7e5208ce1b3cbac1a20f4a1a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 30 May 2021 12:17:16 -0400 Subject: [PATCH] Fix potential KeyError when removing views --- discord/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ui/view.py b/discord/ui/view.py index 81379b329a3b..55806830718f 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -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: