From 60f397da5fd27e2140a0c1b3a102bba0e67c9f19 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 31 Jul 2014 07:32:08 +0200 Subject: Fix NPE regression of commit ba1ffe66697c3175b423cb7ab9b686d73959708d --- src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 016d07ed6..e1cd59a04 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -369,24 +369,23 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe context = null; } - final AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); Throwable exceptionOnUnrealize = null; + Throwable exceptionOnDeviceClose = null; if( null != drawable ) { + final AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); try { drawable.setRealized(false); } catch( final Throwable re ) { exceptionOnUnrealize = re; } drawable = null; - } - - Throwable exceptionOnDeviceClose = null; - try { - if( ownsDevice ) { - device.close(); + try { + if( ownsDevice ) { + device.close(); + } + } catch (final Throwable re) { + exceptionOnDeviceClose = re; } - } catch (final Throwable re) { - exceptionOnDeviceClose = re; } // throw exception in order of occurrence .. -- cgit v1.2.3