修复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

@@ -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