修复ExcelPicUtil中可能的空指针异常

This commit is contained in:
Looly 2025-05-27 12:20:15 +08:00
parent 7f3be3038a
commit 420e54a37d
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.39(2025-05-23)
# 5.8.39(2025-05-27)
### 🐣新特性
* 【ai 】 增加SSE流式返回函数参数callback豆包、grok新增文生图接口豆包生成视频支持使用model
@ -14,6 +14,7 @@
* 【core 】 修复`CharsequenceUtil`toLowerCase方法拼写错误issue#3941@Github
* 【core 】 修复`UUID`equals的问题改为final类issue#3948@Github
* 【core 】 修复`Money`中金额分配的问题bugissue#IC9Y35@Gitee
* 【poi 】 修复`ExcelPicUtil`中可能的空指针异常
-------------------------------------------------------------------------------------------------------------
# 5.8.38(2025-05-13)

View File

@ -99,7 +99,12 @@ public class ExcelPicUtil {
for (XSSFShape shape : shapes) {
if(shape instanceof XSSFPicture){
pic = (XSSFPicture) shape;
ctMarker = pic.getPreferredSize().getFrom();
try{
ctMarker = pic.getPreferredSize().getFrom();
}catch (Exception e){
// 此处可能有空指针异常跳过之
continue;
}
sheetIndexPicMap.put(StrUtil.format("{}_{}", ctMarker.getRow(), ctMarker.getCol()), pic.getPictureData());
}
// 其他类似于图表等忽略see: https://gitee.com/chinabugotech/hutool/issues/I38857