aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2023-08-11 11:23:17 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2023-08-11 11:28:31 +0200
commite6cba76a36237064086d746dbb822e2c42855758 (patch)
tree31a31eaeaa9fafa7d3d7d8db4db1de9b8ec784c7 /pySim-shell.py
parent63e8a188832e490176972de9bea41e8a6abddeb7 (diff)
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
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py2
1 files changed, 1 insertions, 1 deletions
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 @@ 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)