Check if entry exists in dictionary before delete

This commit is contained in:
NIC619
2019-11-17 21:52:05 +08:00
parent 64c49f809f
commit c0522c1bd9
3 changed files with 8 additions and 4 deletions

View File

@ -96,7 +96,8 @@ class MessageCache:
last_entries: List[CacheEntry] = self.history[len(self.history) - 1]
for entry in last_entries:
del self.msgs[entry.mid]
if entry.mid in self.msgs:
del self.msgs[entry.mid]
i: int = len(self.history) - 2