From ac03851ea77e02c36bdffab461e4a0d2a1971f2d Mon Sep 17 00:00:00 2001 From: Wade Walker Date: Tue, 8 Feb 2011 21:36:47 -0600 Subject: Fix ClassCastException when debug logging enabled The debug logging code puts a null reference into a list, then tries to cast it to a WGLGLCapabilities object. --- .../impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index a66d62485..40271d284 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -153,7 +153,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat int numFormats = pformats.length; ArrayList bucket = new ArrayList(numFormats); for (int i = 0; i < numFormats; i++) { - bucket.add( WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, hdc, pformats[i], onscreen) ); + WGLGLCapabilities wglglcapabilities = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, hdc, pformats[i], onscreen); + // formats that don't draw to a window come back null; don't add them or they'll crash debug output + if( wglglcapabilities != null ) + bucket.add( wglglcapabilities ); } return bucket; } -- cgit v1.2.3