Check for header attribute when comparing
authortezeb <tezeb@users.noreply.github.com>
Sun, 25 Sep 2016 18:18:02 +0000 (20:18 +0200)
committertezeb <tezeb@outoftheblue.pl>
Tue, 4 Oct 2016 11:56:17 +0000 (13:56 +0200)
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

index 205805368a993f17af43b6ce05f719b8edbdc383..76f9f2a6b1074e633a06ad97bd6c476aeeb4e356 100644 (file)
@@ -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)