diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 6e6043077..3cb1a13cf 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -223,7 +223,7 @@ class EncryptedStanzaSession(StanzaSession):
 
 	def _is_buggy_gajim(self):
 		c = self._get_contact()
-		if c.supports(xmpp.NS_ROSTERX):
+		if c and c.supports(xmpp.NS_ROSTERX):
 			return False
 		return True