From c61fbf4daa9e1d16e7e50ee199fa2f269ca45d02 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 24 Jul 2022 09:44:31 +0200 Subject: [PATCH] pySim-trace: Support SELECT with empty response body If the modem/UE doesn't ask for the FCP to be returned, a SELECT can exit with 9000 and no response body. Don't crash in that case. Change-Id: I66788717bec921bc54575e60f3f81adc80584dbc --- pySim/apdu/ts_102_221.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pySim/apdu/ts_102_221.py b/pySim/apdu/ts_102_221.py index 9ecc2c97..e5455d03 100644 --- a/pySim/apdu/ts_102_221.py +++ b/pySim/apdu/ts_102_221.py @@ -95,7 +95,9 @@ class UiccSelect(ApduCommand, n='SELECT', ins=0xA4, cla=['0X', '4X', '6X']): # decode the SELECT response if self.successful: self.file = lchan.selected_file - return lchan.selected_file.decode_select_response(self.rsp_dict['body']) + if 'body' in self.rsp_dict: + # not every SELECT is asking for the FCP in response... + return lchan.selected_file.decode_select_response(self.rsp_dict['body']) return None