aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Jordan <[email protected]>2020-01-26 10:52:28 +1300
committerGitHub <[email protected]>2020-01-26 10:52:28 +1300
commit80bb7518daef2f30e9dcb7b5501a752593bf1884 (patch)
tree082ebd4c01c1c824e879eef46b4e076d6c043a02
parent7e122e7557ad71f0ea76ea248032235c19b00d25 (diff)
parentb87d3e93f0d0c7dc0101cbcbc5cb487244f46eb5 (diff)
Merge pull request #3 from etsinko/npe-fix
fixed a NPE that happened during offscreen rendering
-rw-r--r--src/main/java/org/jogamp/java3d/CanvasViewCache.java8
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;