From b9d962d4f83eae5756acdc8b2429654e774d24c4 Mon Sep 17 00:00:00 2001 From: "Dante (Kuo-Jung) Su" Date: Fri, 26 Jul 2019 05:50:54 +0800 Subject: [PATCH] sfpshow: prevent 'show int trans eeprom --dom' from crashing (#567) When some specific 25G DAC attached to the system, the 'dom_info_dict' could be a None object, as a result, the 'show int transceiver eeprom --dom' will crash. And thus, in this commit, we'll add an additional checker for the None object. Signed-off-by: Dante (Kuo-Jung) Su Change-Id: Ic2b5eb38ddf98b98cce7eddf161595013a19c720 --- scripts/sfpshow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index d07a10ffd09d..52882e6665fd 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -75,7 +75,7 @@ class SFPShow(object): out_put='' ident = ' ' for key in sorted_key_table: - if dom_info_dict[key] != 'N/A': + if dom_info_dict is not None and dom_info_dict[key] != 'N/A': if dom_info_dict[key] == 'Unknown': out_put = out_put + ident + ident + channel_monitor_map[key] + ': ' + dom_info_dict[key] + '\n' else: