summaryrefslogtreecommitdiffstats
path: root/python-ethtool/etherinfo_obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'python-ethtool/etherinfo_obj.c')
-rw-r--r--python-ethtool/etherinfo_obj.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/python-ethtool/etherinfo_obj.c b/python-ethtool/etherinfo_obj.c
index f620157..cd7f2e3 100644
--- a/python-ethtool/etherinfo_obj.c
+++ b/python-ethtool/etherinfo_obj.c
@@ -104,7 +104,9 @@ PyObject *_ethtool_etherinfo_getter(PyEtherInfo *self, PyObject *attr_o)
}
} else if( strcmp(attr, "mac_address") == 0 ) {
get_etherinfo_link(self);
- Py_INCREF(self->hwaddress);
+ if( self->hwaddress ) {
+ Py_INCREF(self->hwaddress);
+ }
return self->hwaddress;
} else if( strcmp(attr, "ipv4_address") == 0 ) {
addrlist = get_etherinfo_address(self, NLQRY_ADDR4);