Fix retreiving an empty MAC address string on some devices

This commit is contained in:
Cameron Gutman 2014-01-12 19:48:31 -05:00
parent 6a695d2c72
commit ab1e47edb4

View File

@ -62,7 +62,8 @@ public class NvConnection {
NetworkInterface iface = ifaceList.nextElement(); NetworkInterface iface = ifaceList.nextElement();
if (iface.getName().startsWith("wlan") && if (iface.getName().startsWith("wlan") &&
iface.getHardwareAddress() != null) { iface.getHardwareAddress() != null &&
iface.getHardwareAddress().length > 0) {
selectedIface = iface; selectedIface = iface;
} }
} }
@ -73,7 +74,8 @@ public class NvConnection {
NetworkInterface iface = ifaceList.nextElement(); NetworkInterface iface = ifaceList.nextElement();
if (iface.getName().startsWith("eth") && if (iface.getName().startsWith("eth") &&
iface.getHardwareAddress() != null) { iface.getHardwareAddress() != null &&
iface.getHardwareAddress().length > 0) {
selectedIface = iface; selectedIface = iface;
} }
} }
@ -83,7 +85,8 @@ public class NvConnection {
while (selectedIface == null && ifaceList.hasMoreElements()) { while (selectedIface == null && ifaceList.hasMoreElements()) {
NetworkInterface iface = ifaceList.nextElement(); NetworkInterface iface = ifaceList.nextElement();
if (iface.getHardwareAddress() != null) { if (iface.getHardwareAddress() != null &&
iface.getHardwareAddress().length > 0) {
selectedIface = iface; selectedIface = iface;
break; break;
} }