Avoid NPE with malformed anchors in slideshow files

This commit is contained in:
Dominik Stadler 2026-02-14 17:15:14 +01:00
parent 5338b17a8f
commit 55c1608a2d
3 changed files with 11 additions and 7 deletions

View File

@ -204,12 +204,16 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
* @return the anchor of this shape group
*/
@Override
public Rectangle2D getAnchor(){
public Rectangle2D getAnchor() {
EscherClientAnchorRecord clientAnchor = getEscherChild(EscherClientAnchorRecord.RECORD_ID);
int x1,y1,x2,y2;
if(clientAnchor == null){
if(clientAnchor == null) {
LOG.atInfo().log("EscherClientAnchorRecord was not found for shape group. Searching for EscherChildAnchorRecord.");
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();
y1 = rec.getDy1();
x2 = rec.getDx2();

Binary file not shown.