diff options
author | Egor Tsinko <[email protected]> | 2020-01-22 15:06:57 -0700 |
---|---|---|
committer | Philip Jordan <[email protected]> | 2020-01-26 11:13:06 +1300 |
commit | 17f8f4f652eab7f1586e21e72a1ccf4b52ce0a0a (patch) | |
tree | 9305100025290451c01a02407cb67287a1c976a1 | |
parent | 239b497e3c012bfee176192cd344bbeb0c3cf192 (diff) |
fixed a NPE that happened during offscreen rendering
-rw-r--r-- | src/main/java/org/jogamp/java3d/CanvasViewCache.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/jogamp/java3d/CanvasViewCache.java b/src/main/java/org/jogamp/java3d/CanvasViewCache.java index 1edb33e..1532a81 100644 --- a/src/main/java/org/jogamp/java3d/CanvasViewCache.java +++ b/src/main/java/org/jogamp/java3d/CanvasViewCache.java @@ -589,9 +589,11 @@ class CanvasViewCache extends Object { // 0.666x0.666 = 0.444 scaling. This is not a Java3D issue. try { final Graphics2D g2d = (Graphics2D) canvas.getGraphics(); - final AffineTransform t = g2d.getTransform(); - hiDPIXScale = t.getScaleX(); - hiDPIYScale = t.getScaleY(); + if (g2d != null) { + final AffineTransform t = g2d.getTransform(); + hiDPIXScale = t.getScaleX(); + hiDPIYScale = t.getScaleY(); + } } catch (IllegalComponentStateException e) {} metersPerPixelX = screenViewCache.metersPerPixelX; |