From eb9ab56c6ec2037a24dfba970059a61ed072ff68 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 24 May 2018 15:01:17 +0300 Subject: [PATCH] fix for deleting last contact in list --- toxygen/contacts/contacts_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toxygen/contacts/contacts_manager.py b/toxygen/contacts/contacts_manager.py index 02028d7..c99d439 100644 --- a/toxygen/contacts/contacts_manager.py +++ b/toxygen/contacts/contacts_manager.py @@ -464,8 +464,8 @@ class ContactsManager(ToxSave): self._history.delete_history(contact) def _delete_contact(self, num): + if num == self._active_contact: # active friend was deleted + self.set_active(0 if len(self._contacts) - 1 else -1) del self._contacts[num] self._screen.friends_list.takeItem(num) - if num == self._active_contact: # active friend was deleted - self.set_active(0 if len(self._contacts) else -1) self._save_profile()