aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-18 17:23:49 +0200
committerSven Gothel <[email protected]>2012-10-18 17:23:49 +0200
commit5c21146b8fc75481b9ae164c2e9f5cfbfb8897a1 (patch)
treeae13d124f26d3c90322832571c06e2d02d00ab95 /src/jake2/render
parent7a595526b86b6fc0c590002f21aafde1e5212e39 (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.java5
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;
}