mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix mac null bug
This commit is contained in:
@@ -507,9 +507,12 @@ public class NetUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] mac;
|
||||
byte[] mac = null;
|
||||
try {
|
||||
mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
|
||||
final NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress);
|
||||
if(null != networkInterface){
|
||||
mac = networkInterface.getHardwareAddress();
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
throw new UtilException(e);
|
||||
}
|
||||
@@ -526,6 +529,7 @@ public class NetUtil {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user