jp: fixed crash on commands using profile without "connect" option
This commit is contained in:
parent
761d3efc8c
commit
ffd6afcbb1
1 changed files with 5 additions and 2 deletions
|
|
@ -221,6 +221,7 @@ class Jp(object):
|
||||||
|
|
||||||
def connect_profile(self, callback):
|
def connect_profile(self, callback):
|
||||||
""" Check if the profile is connected
|
""" Check if the profile is connected
|
||||||
|
|
||||||
@param callback: method to call when profile is connected
|
@param callback: method to call when profile is connected
|
||||||
@exit: - 1 when profile is not connected and --connect is not set
|
@exit: - 1 when profile is not connected and --connect is not set
|
||||||
- 1 when the profile doesn't exists
|
- 1 when the profile doesn't exists
|
||||||
|
|
@ -238,11 +239,13 @@ class Jp(object):
|
||||||
error(_("The profile [%s] doesn't exist") % self.args.profile)
|
error(_("The profile [%s] doesn't exist") % self.args.profile)
|
||||||
self.quit(1)
|
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.bridge.asyncConnect(self.profile, self.args.connect, lambda dummy: callback(), cant_connect)
|
||||||
self._auto_loop = True
|
self._auto_loop = True
|
||||||
return
|
return
|
||||||
|
|
||||||
elif not self.bridge.isConnected(self.profile):
|
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 })
|
error(_(u"Profile [%(profile)s] is not connected, please connect it before using jp, or use --connect option") % { "profile": self.profile })
|
||||||
self.quit(1)
|
self.quit(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue