From f69d0aa724940cfbbccd0278b60353bbad581653 Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 26 Feb 2020 14:01:22 -0300 Subject: [PATCH] ignore KeyErrors when removing flags --- litecord/pubsub/dispatcher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litecord/pubsub/dispatcher.py b/litecord/pubsub/dispatcher.py index 5ab3e6b..cb7507a 100644 --- a/litecord/pubsub/dispatcher.py +++ b/litecord/pubsub/dispatcher.py @@ -140,7 +140,10 @@ class DispatcherWithFlags( def remove_flags(self, key: K, identifier: V): """Set flags for the given identifier.""" - self.flags[key].pop(identifier) + try: + self.flags[key].pop(identifier) + except KeyError: + pass def get_flags(self, key: K, identifier: V): """Get a single field from the flags store."""