修复一个可能触发 NPE 的问题
ZLMediaKit 回应中可能没有 tracks 字段,导致报 NPE,使得资源没有被正确释放
This commit is contained in:
@@ -10,6 +10,8 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* 视频信息
|
||||
*/
|
||||
@@ -106,7 +108,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");
|
||||
|
||||
Reference in New Issue
Block a user