laforge has uploaded this change for review.

View Change

pySim.esim.saip.FsNodeADF: Fix __str__ method

It's quite common for a FsNodeADF to not have a df_name, so we need
to guard against that during stringification to avoid an exception.

Change-Id: I919d7c46575e0ebcdf3b979347a5cdd1a9feb294
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/59/40759/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 305a373..7646989 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -2040,7 +2040,8 @@
super().__init__(fid, parent, file, name)

def __str__(self):
- return '%s(%s)' % (self.__class__.__name__, b2h(self.df_name))
+ # self.df_name is usually None for an ADF like ADF.USIM or ADF.ISIM so we need to guard against it
+ return '%s(%s)' % (self.__class__.__name__, b2h(self.df_name) if self.df_name else None)

class FsNodeMF(FsNodeDF):
"""The MF (Master File) in the filesystem hierarchy."""

To view, visit change 40759. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I919d7c46575e0ebcdf3b979347a5cdd1a9feb294
Gerrit-Change-Number: 40759
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>