From e6cba76a36237064086d746dbb822e2c42855758 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 11 Aug 2023 11:23:17 +0200 Subject: [PATCH] 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 --- pySim-shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim-shell.py b/pySim-shell.py index 2e332d3a..2727a5b8 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -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)