mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
Avoid NPE with malformed anchors in slideshow files
This commit is contained in:
parent
5338b17a8f
commit
55c1608a2d
@ -204,12 +204,16 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
|
|||||||
* @return the anchor of this shape group
|
* @return the anchor of this shape group
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Rectangle2D getAnchor(){
|
public Rectangle2D getAnchor() {
|
||||||
EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
|
EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
if(clientAnchor == null){
|
if(clientAnchor == null) {
|
||||||
LOG.atInfo().log("EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
|
LOG.atInfo().log("EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
|
||||||
EscherChildAnchorRecord rec = getEscherChild(EscherChildAnchorRecord.RECORD_ID);
|
EscherChildAnchorRecord rec = getEscherChild(EscherChildAnchorRecord.RECORD_ID);
|
||||||
|
if (rec == null) {
|
||||||
|
throw new IllegalStateException("Cannot get anchor, neither had an EscherClientAnchorRecord nor an EscherChildAnchorRecord");
|
||||||
|
}
|
||||||
|
|
||||||
x1 = rec.getDx1();
|
x1 = rec.getDx1();
|
||||||
y1 = rec.getDy1();
|
y1 = rec.getDy1();
|
||||||
x2 = rec.getDx2();
|
x2 = rec.getDx2();
|
||||||
|
|||||||
BIN
test-data/slideshow/62d2ecd89aeb715b07072d4f8a8734f4dbeb5c10.ppt
Normal file
BIN
test-data/slideshow/62d2ecd89aeb715b07072d4f8a8734f4dbeb5c10.ppt
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user