From 682aeb7fd2365284f78f4e3bb8e05fadf75b9a25 Mon Sep 17 00:00:00 2001
From: inso <insomniak.fr@gmaiL.com>
Date: Sat, 14 Jan 2017 19:11:47 +0100
Subject: [PATCH] Fix connecting to wallet

---
 src/sakia/gui/dialogs/connection_cfg/controller.py | 2 ++
 src/sakia/gui/dialogs/connection_cfg/model.py      | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sakia/gui/dialogs/connection_cfg/controller.py b/src/sakia/gui/dialogs/connection_cfg/controller.py
index 148e6ca9..f9c7d094 100644
--- a/src/sakia/gui/dialogs/connection_cfg/controller.py
+++ b/src/sakia/gui/dialogs/connection_cfg/controller.py
@@ -202,6 +202,8 @@ class ConnectionConfigController(QObject):
             if self.model.node_connector:
                 await self.model.node_connector.session.close()
         except (NoPeerAvailable, DuniterError, StopIteration) as e:
+            if not isinstance(e, StopIteration):
+                self.view.show_error(self.model.notification(), str(e))
             self._logger.debug(str(e))
             self.view.stacked_pages.setCurrentWidget(self.view.page_connection)
             self.step_node = asyncio.Future()
diff --git a/src/sakia/gui/dialogs/connection_cfg/model.py b/src/sakia/gui/dialogs/connection_cfg/model.py
index a2fd6d53..2ab5ec9b 100644
--- a/src/sakia/gui/dialogs/connection_cfg/model.py
+++ b/src/sakia/gui/dialogs/connection_cfg/model.py
@@ -193,13 +193,14 @@ Current database is storing {1} network.""".format(node_connector.node.currency,
         # cell 1 contains the uid/pubkey selected locally
         # cell 2 contains the uid/pubkey found on the network
         registered = (False, identity.uid, None)
+
         # We execute search based on pubkey
         # And look for account UID
         await execute_requests(_parse_uid_lookup, identity.pubkey)
 
         # If the uid wasn't found when looking for the pubkey
         # We look for the uid and check for the pubkey
-        if not registered[0] and not registered[2]:
+        if not registered[0] and not registered[2] and identity.uid:
             await execute_requests(_parse_pubkey_lookup, identity.uid)
 
         return registered, found_identity
-- 
GitLab