changeset 1401:265ff2bd8d67

jp: fixed crash on commands using profile without "connect" option
author Goffi <goffi@goffi.org>
date Mon, 06 Apr 2015 12:11:23 +0200
parents c8459b53bb81
children 391b0c21f4be
files frontends/src/jp/base.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/base.py	Thu Apr 02 00:00:33 2015 +0200
+++ b/frontends/src/jp/base.py	Mon Apr 06 12:11:23 2015 +0200
@@ -221,6 +221,7 @@
 
     def connect_profile(self, callback):
         """ Check if the profile is connected
+
         @param callback: method to call when profile is connected
         @exit: - 1 when profile is not connected and --connect is not set
                - 1 when the profile doesn't exists
@@ -238,11 +239,13 @@
             error(_("The profile [%s] doesn't exist") % self.args.profile)
             self.quit(1)
 
-        if self.args.connect is not None:  # if connection is asked, we connect the profile
+        if not hasattr(self.args, 'connect'):
+            # a profile can be presente without connect option (e.g. on profile creation/deletion)
+            return
+        elif self.args.connect is not None:  # if connection is asked, we connect the profile
             self.bridge.asyncConnect(self.profile, self.args.connect, lambda dummy: callback(), cant_connect)
             self._auto_loop = True
             return
-
         elif not self.bridge.isConnected(self.profile):
             error(_(u"Profile [%(profile)s] is not connected, please connect it before using jp, or use --connect option") % { "profile": self.profile })
             self.quit(1)