mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix mac null bug
This commit is contained in:
parent
2e6515ef06
commit
9d8f4d725c
@ -13,6 +13,7 @@
|
|||||||
* 【extra 】 新增方便引入SpringUtil的注解@EnableSpringUtil(pr#172@Gitee)
|
* 【extra 】 新增方便引入SpringUtil的注解@EnableSpringUtil(pr#172@Gitee)
|
||||||
* 【poi 】 RowUtil增加插入和删除行(pr#1060@Github)
|
* 【poi 】 RowUtil增加插入和删除行(pr#1060@Github)
|
||||||
* 【extra 】 SpringUtil增加注册bean(pr#174@Gitee)
|
* 【extra 】 SpringUtil增加注册bean(pr#174@Gitee)
|
||||||
|
* 【core 】 修改NetUtil.getMacAddress避免空指针(issue#1057@Github)
|
||||||
|
|
||||||
### Bug修复#
|
### Bug修复#
|
||||||
* 【core 】 重新整理农历节假日,解决一个pr过来的玩笑导致的问题
|
* 【core 】 重新整理农历节假日,解决一个pr过来的玩笑导致的问题
|
||||||
|
@ -507,9 +507,12 @@ public class NetUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] mac;
|
byte[] mac = null;
|
||||||
try {
|
try {
|
||||||
mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
|
final NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress);
|
||||||
|
if(null != networkInterface){
|
||||||
|
mac = networkInterface.getHardwareAddress();
|
||||||
|
}
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
throw new UtilException(e);
|
throw new UtilException(e);
|
||||||
}
|
}
|
||||||
@ -526,6 +529,7 @@ public class NetUtil {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user