Merge pull request #1760 from QianNangong/patch-3

修复一个可能触发 NPE 的问题
This commit is contained in:
648540858
2025-01-27 07:39:35 +08:00
committed by GitHub

View File

@@ -10,6 +10,8 @@ import lombok.Data;
import java.util.List;
import java.util.Map;
import org.springframework.util.ObjectUtils;
/**
* 视频信息
*/
@@ -82,6 +84,8 @@ public class MediaInfo {
Long bytesSpeed = jsonObject.getLong("bytesSpeed");
if (totalReaderCount != null) {
mediaInfo.setReaderCount(totalReaderCount);
} else {
mediaInfo.setReaderCount(0);
}
if (online != null) {
mediaInfo.setOnline(online);
@@ -106,7 +110,7 @@ public class MediaInfo {
}
}
JSONArray jsonArray = jsonObject.getJSONArray("tracks");
if (!jsonArray.isEmpty()) {
if (!ObjectUtils.isEmpty(jsonArray)) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject trackJson = jsonArray.getJSONObject(i);
Integer channels = trackJson.getInteger("channels");