diff --git a/src/gajim.py b/src/gajim.py
index ec456989d92d509938d21c4c79f1df86484d1346..3d909dfb65c94cc3b9cd06f50546225317d3df37 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -1108,7 +1108,8 @@ class Interface:
 			if not gajim.config.get('showoffline'):
 				contact = gajim.contacts.get_contact_with_highest_priority(account,
 					jid)
-				self.roster.really_remove_contact(contact, account)
+				if contact:	
+					self.roster.really_remove_contact(contact, account)
 		self.redraw_roster_systray(account, jid, typ)
 
 	def remove_event(self, account, jid, event):
@@ -1122,7 +1123,8 @@ class Interface:
 			if not gajim.config.get('showoffline'):
 				contact = gajim.contacts.get_contact_with_highest_priority(account,
 					jid)
-				self.roster.really_remove_contact(contact, account)
+				if contact:		
+					self.roster.really_remove_contact(contact, account)
 		self.redraw_roster_systray(account, jid, event[0])
 
 	def handle_event_file_request_error(self, account, array):