From b7b51025b94f77130f355a2c7b00a0fbcf533b2d Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 28 Apr 2018 06:32:17 +0800 Subject: BaseTools: check before accessing members in __eq__ minimize risk for exceptions. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py') diff --git a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py index 602c90b3fe..1328dddf1a 100644 --- a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py +++ b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py @@ -259,10 +259,7 @@ class VAR_CHECK_PCD_VALID_OBJ(object): self.ValidData = False def __eq__(self, validObj): - if self.VarOffset == validObj.VarOffset: - return True - else: - return False + return validObj and self.VarOffset == validObj.VarOffset class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ): def __init__(self, VarOffset, validlist, PcdDataType): -- cgit v1.2.3