Skip to content

Commit 474ae6b

Browse files
authored
GH-1510: Add null check to ElkLayoutEngine (#257)
Add null check for parent position to `getOffset` computation. Fixes eclipse-glsp/glsp/issues/1510
1 parent 6f66a85 commit 474ae6b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/org.eclipse.glsp.layout/src/org/eclipse/glsp/layout/ElkLayoutEngine.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,10 @@ protected GPoint getOffset(final GModelElement gelem, final ElkGraphElement elkE
528528
for (GModelElement sParent : sParents) {
529529
if (sParent instanceof GBoundsAware) {
530530
GPoint position = ((GBoundsAware) sParent).getPosition();
531-
x -= position.getX();
532-
y -= position.getY();
531+
if (position != null) {
532+
x -= position.getX();
533+
y -= position.getY();
534+
}
533535
}
534536
}
535537
}

0 commit comments

Comments
 (0)