From 4c445f6f993ee62fa41f8e897cce03303a94ecba Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 18 May 2015 11:09:10 -0400 Subject: [PATCH] better exception handling, fixes #3293 --- core/src/processing/opengl/PSurfaceJOGL.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index f7d03c4e9..19963b1b0 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -268,10 +268,13 @@ public class PSurfaceJOGL implements PSurface { e.printStackTrace(); } // System.err.println("Caught exception: " + drawException.getMessage()); - if (drawException instanceof RuntimeException) { - throw (RuntimeException)drawException.getCause(); - } else { - throw new RuntimeException(drawException.getCause()); + if (drawException != null) { + Throwable cause = drawException.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException)cause; + } else if (!(cause instanceof java.lang.ThreadDeath)) { + throw new RuntimeException(cause); + } } } }