Skip to content

Commit

Permalink
set native insets only if peer is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
aghaisas committed Mar 19, 2021
1 parent d2144a5 commit 8f45d78
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -92,8 +92,10 @@ public SurfaceData replaceSurfaceData() {
MTLGraphicsConfig gc = (MTLGraphicsConfig)getGraphicsConfiguration();
surfaceData = gc.createSurfaceData(this);
setScale(gc.getDevice().getScaleFactor());
Insets insets = peer.getInsets();
execute(ptr -> nativeSetInsets(ptr, insets.top, insets.left));
if (peer != null) {
Insets insets = peer.getInsets();
execute(ptr -> nativeSetInsets(ptr, insets.top, insets.left));
}
// the layer holds a reference to the buffer, which in
// turn has a reference back to this layer
if (surfaceData instanceof MTLSurfaceData) {
Expand Down

0 comments on commit 8f45d78

Please sign in to comment.