diff --git a/src/common/xmpp/client_nb.py b/src/common/xmpp/client_nb.py
index f6c3846e6d094d777c29160b7a696bf29aeb965c..44ea3ba3e9480f2f5b9d74e7b6098bf7fc041b2b 100644
--- a/src/common/xmpp/client_nb.py
+++ b/src/common/xmpp/client_nb.py
@@ -362,6 +362,9 @@ class NonBlockingClient:
         supported and desired.
         """
         self.stream_started = True
+        if not hasattr(self, 'onreceive'):
+            # we may already have been disconnected
+            return
         self.onreceive(None)
 
         if self.connected == 'plain':