debug:发送命令超时会空指针

This commit is contained in:
墨大叔 2024-08-22 15:18:40 +08:00
parent a3c82d662f
commit 7377d39b19

View File

@ -25,6 +25,7 @@ public enum IotHttpStatus {
DEVICE_EVENT_HISTORY_DATA_QUERY_FAIL(10419, "设备事件历史数据查询失败"),
DEVICE_OPERATE_RECORD_QUERY_FAIL(10420, "设备操作记录查询失败"),
DEVICE_NOT_ONLINE(10421, "设备不在线"),
TIME_OUT(10500, "发送命令超时"),
UNKNOWN_ERROR(null, "未知错误");
private final Integer code;
@ -37,7 +38,7 @@ public enum IotHttpStatus {
// 将code转换为枚举
public static IotHttpStatus convertByCode(int code) {
for (IotHttpStatus status : IotHttpStatus.values()) {
if (status.getCode() == code) {
if (status.getCode() != null && status.getCode() == code) {
return status;
}
}