avoid nulls in HSSFWorkbook.getAllPictures when EscherBlipRecord is not found

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1025635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2010-10-20 16:38:06 +00:00
parent 26b76c1087
commit 3fe64d57ae
2 changed files with 12 additions and 2 deletions

View File

@ -1594,8 +1594,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
// TODO: Some kind of structure.
HSSFPictureData picture = new HSSFPictureData(blip);
pictures.add(picture);
} else {
pictures.add(null);
}

View File

@ -71,4 +71,16 @@ public final class TestHSSFPictureData extends TestCase{
}
}
}
public void testNotNullPictures() throws IOException {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("SheetWithDrawing.xls");
@SuppressWarnings("unchecked") // TODO - add getFormat() to interface PictureData and genericise wb.getAllPictures()
List<HSSFPictureData> lst = (List<HSSFPictureData>)(List<?>)wb.getAllPictures();
for(HSSFPictureData pict : lst){
assertNotNull(pict);
}
}
}