From 947154639c9ac57da76fbc6235818df4c93e2ec3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 16 Jun 2025 11:59:19 +0200 Subject: [PATCH] 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 --- pySim/esim/saip/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index c97195f0..3828023e 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -2040,7 +2040,8 @@ class FsNodeADF(FsNodeDF): 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."""