You've already forked FrameTour-BE
fix(video): 解决视频数据获取时的空指针异常
- 添加了 contentPageVO 为 null 的检查并返回 null 避免后续操作 - 添加了 videoRespVO 为 null 的检查并返回 null 避免后续操作 - 在流处理后添加了非空过滤确保结果列表不包含 null 值
This commit is contained in:
@@ -206,8 +206,14 @@ public class LyCompatibleController {
|
||||
.values().stream()
|
||||
.map(contentPageVOs -> {
|
||||
ContentPageVO contentPageVO = contentPageVOs.stream().filter(vo -> vo.getContentId() != null).findFirst().orElse(null);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (contentPageVO == null) {
|
||||
return null;
|
||||
}
|
||||
VideoEntity videoRespVO = videoRepository.getVideo(contentPageVO.getContentId());
|
||||
if (videoRespVO == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", videoRespVO.getId().toString());
|
||||
map.put("task_id", videoRespVO.getTaskId().toString());
|
||||
if (videoRespVO.getFaceId() != null) {
|
||||
@@ -221,7 +227,7 @@ public class LyCompatibleController {
|
||||
map.put("title", contentPageVO.getName());
|
||||
map.put("ossurldm", videoRespVO.getVideoUrl());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}).filter(java.util.Objects::nonNull).collect(Collectors.toList());
|
||||
GoodsReqQuery goodsReqQuery = new GoodsReqQuery();
|
||||
goodsReqQuery.setFaceId(faceVO.getId());
|
||||
goodsReqQuery.setSourceType(1);
|
||||
|
||||
Reference in New Issue
Block a user