# Buggy code
def __eq__(self, other):
    if hasattr(other, "parsed"):
        p2 = other.parsed
    else:
        p2, nm2 = self._parse_net(other)
    return self.parsed == p2


# Traceback (AttributeError)
a = Ether(dst='64:A2:F9:A9:2E:A9')/ARP(pdst='192.168.178.0/24')
a.show()

AttributeError
Traceback (most recent call last)<ipython-input-18-97d3136b2c17> in <module>
----> 1 a.show()

/netdisk/home/gpotter/github/scapy/scapy/packet.py in show(self, dump, indent, lvl, label_lvl)
1251         :return: return a hierarchical view if dump, else print it
1252         """
-> 1253         return self._show_or_dump(dump, indent, lvl, label_lvl)
1254
1255     def show2(self, dump=False, indent=3, lvl="", label_lvl=""):

/netdisk/home/gpotter/github/scapy/scapy/packet.py in _show_or_dump(self, dump, indent, lvl, label_lvl, first_call)
1225                                          ncol(f.name),
1226                                          ct.punct("="),)
-> 1227                 reprval = f.i2repr(self, fvalue)
1228                 if isinstance(reprval, str):
1229                     reprval = reprval.replace("\n", "\n" + " " * (len(label_lvl) +  # noqa: E501

/netdisk/home/gpotter/github/scapy/scapy/fields.py in i2repr(self, pkt, x)
513
514     def i2repr(self, pkt, x):
--> 515         x = self.i2h(pkt, x)
516         if self in conf.resolve:
517             x = conf.manufdb._resolve_MAC(x)

/netdisk/home/gpotter/github/scapy/scapy/layers/l2.py in i2h(self, pkt, x)
140     def i2h(self, pkt, x):
141         if x is None:
--> 142             iff = self.getif(pkt)
143             if iff is None:
144                 iff = conf.iface

/netdisk/home/gpotter/github/scapy/scapy/layers/l2.py in <lambda>(pkt)
136     def __init__(self, name, getif=None):
137         MACField.__init__(self, name, None)
--> 138         self.getif = (lambda pkt: pkt.route()[0]) if getif is None else getif
139
140     def i2h(self, pkt, x):

/netdisk/home/gpotter/github/scapy/scapy/packet.py in route(self)
1175
1176     def route(self):
-> 1177         return self.payload.route()
1178
1179     def fragment(self, *args, **kargs):

/netdisk/home/gpotter/github/scapy/scapy/layers/l2.py in route(self)
411     def route(self):
412         fld, dst = self.getfield_and_val("pdst")--> 413         fld, dst = fld._find_fld_pkt_val(self, dst)
414         if isinstance(dst, Gen):
415             dst = next(iter(dst))

/netdisk/home/gpotter/github/scapy/scapy/fields.py in _find_fld_pkt_val(self, pkt, val)
324         # Default ? (in this case, let's make sure it's up-do-date)
325         dflts_pkt = pkt.default_fields
--> 326         if val == dflts_pkt[self.name] and self.name not in pkt.fields:
327             dflts_pkt[self.name] = fld.default
328             val = fld.default

/netdisk/home/gpotter/github/scapy/scapy/base_classes.py in __eq__(self, other)
131             p2 = other.parsed
132         else:
--> 133             p2, nm2 = self._parse_net(other)
134         return self.parsed == p2
135

/netdisk/home/gpotter/github/scapy/scapy/base_classes.py in _parse_net(cls, net)
97     @classmethod
98     def _parse_net(cls, net):
---> 99         tmp = net.split('/') + ["32"]
100         if not cls.ip_regex.match(net):
101             tmp[0] = socket.gethostbyname(tmp[0])

AttributeError: 'NoneType' object has no attribute 'split'

# Fixed code
def __eq__(self, other):
    if not other:
        return False
    if hasattr(other, "parsed"):
        p2 = other.parsed
    else:
        p2, nm2 = self._parse_net(other)
    return self.parsed == p2