dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/34143 )
Change subject: pySim-shell: check presence of runtime state before accessing it ......................................................................
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 --- M pySim-shell.py 1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/43/34143/1
diff --git a/pySim-shell.py b/pySim-shell.py index 2e332d3..2727a5b 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -301,7 +301,7 @@ @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)