From aae68b7786778014f4c1599aa3c620f347cce28a Mon Sep 17 00:00:00 2001 From: tezeb Date: Sun, 25 Sep 2016 20:18:02 +0200 Subject: [PATCH] Check for header attribute when comparing When checking against None it throws exception, while it's quite easy to prevent(and check against None seems quite obvious). --- elftools/elf/sections.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elftools/elf/sections.py b/elftools/elf/sections.py index 2058053..76f9f2a 100644 --- a/elftools/elf/sections.py +++ b/elftools/elf/sections.py @@ -41,7 +41,11 @@ class Section(object): return self.header[name] def __eq__(self, other): - return self.header == other.header + try: + return self.header == other.header + except AttributeError: + return False + def __hash__(self): return hash(self.header) -- 2.30.2