mirror of https://gerrit.osmocom.org/pysim
pySim-shell: check presence of runtime state before accessing it
When the command equip (do_equip) is executed, it accesses self.rs.profile to see if there are any commands that need to be unregistered before moving on with the card initialization. However, it may be the case that no runtime state exists at this point. This is in particular the case when the card is completely empty and hence no profile is picked and no runtime state exists. Change-Id: I0a8be66a69b630f1f2898b62dc752a8eb5275301
This commit is contained in:
parent
63e8a18883
commit
e6cba76a36
|
@ -301,7 +301,7 @@ class PysimApp(Cmd2Compat):
|
|||
@cmd2.with_category(CUSTOM_CATEGORY)
|
||||
def do_equip(self, opts):
|
||||
"""Equip pySim-shell with card"""
|
||||
if self.rs.profile:
|
||||
if self.rs and self.rs.profile:
|
||||
for cmd_set in self.rs.profile.shell_cmdsets:
|
||||
self.unregister_command_set(cmd_set)
|
||||
rs, card = init_card(sl)
|
||||
|
|
Loading…
Reference in New Issue