diff options
author | Sven Gothel <[email protected]> | 2012-10-18 17:23:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-18 17:23:49 +0200 |
commit | 5c21146b8fc75481b9ae164c2e9f5cfbfb8897a1 (patch) | |
tree | ae13d124f26d3c90322832571c06e2d02d00ab95 /src/jake2/render | |
parent | 7a595526b86b6fc0c590002f21aafde1e5212e39 (diff) |
NEWTWin: Fix NPE if Screen is not initialized yet (fullscreen mode)
Diffstat (limited to 'src/jake2/render')
-rw-r--r-- | src/jake2/render/opengl/NEWTWin.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jake2/render/opengl/NEWTWin.java b/src/jake2/render/opengl/NEWTWin.java index 078f97c..28a6019 100644 --- a/src/jake2/render/opengl/NEWTWin.java +++ b/src/jake2/render/opengl/NEWTWin.java @@ -48,7 +48,7 @@ public class NEWTWin { public ScreenMode findDisplayMode(DimensionImmutable dim) { final List<ScreenMode> sml = ScreenModeUtil.filterByResolution(screen.getScreenModes(), dim); - if(sml.size() == 0) { + if(null == sml || sml.size() == 0) { return oldDisplayMode; } return sml.get(0); @@ -96,6 +96,9 @@ public class NEWTWin { screen = NewtFactory.createScreen(NewtFactory.createDisplay(null), 0); screen.addReference(); // trigger native creation screenRemRef = true; + } else if( !screen.isNativeValid() ) { + screen.addReference(); // trigger native creation + screenRemRef = true; } else { screenRemRef = false; } |