laforge submitted this change.
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(-)
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)
To view, visit change 34143. To unsubscribe, or for help writing mail filters, visit settings.