Handle the case where the MAC address cannot be retreived for some interface

This commit is contained in:
Cameron Gutman 2013-11-05 11:54:08 -05:00
parent 7704ceb32b
commit 9b91543c2d

View File

@ -49,7 +49,7 @@ public class NvConnection {
* connecting over different interfaces */
if (!iface.isLoopback()) {
byte[] macAddress = iface.getHardwareAddress();
if (macAddress.length == 6) {
if (macAddress != null && macAddress.length == 6) {
StringBuilder addrStr = new StringBuilder();
for (int i = 0; i < macAddress.length; i++) {
addrStr.append(String.format("%02x", macAddress[i]));