add check

This commit is contained in:
Looly 2022-04-13 17:27:44 +08:00
parent a938455c2e
commit c2707b6180
2 changed files with 4 additions and 1 deletions

View File

@ -18,6 +18,7 @@
* 【core 】 JarClassLoader增加构造pr#593@Gitee
* 【core 】 增加Pid以便获取单例pid
* 【core 】 Img增加全覆盖水印pressTextFullpr#595@Gitee
* 【core 】 ByteUtil.numberToBytes增加Byte判断issue#2252@Github
### 🐞Bug修复
* 【core 】 修复UserAgentUtil识别Linux出错issue#I50YGY@Gitee

View File

@ -405,7 +405,9 @@ public class ByteUtil {
* @return bytes
*/
public static byte[] numberToBytes(Number number, ByteOrder byteOrder) {
if (number instanceof Double) {
if(number instanceof Byte){
return new byte[]{number.byteValue()};
}else if (number instanceof Double) {
return doubleToBytes((Double) number, byteOrder);
} else if (number instanceof Long) {
return longToBytes((Long) number, byteOrder);