From 2ed9ba283b4f68ba1d3ac972e1814f44c3007dd0 Mon Sep 17 00:00:00 2001 From: Miles Fogle Date: Sat, 27 Jan 2018 15:22:54 -0600 Subject: [PATCH] fix NPE when closing sketch window on Mac (#5214) This fixes the first error mentioned in the issue, but not the other one mentioned by @christianbender. Tested on macOS High Sierra (10.13.2) --- core/src/processing/core/PApplet.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 3feb82b72..0f2249034 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -3703,8 +3703,7 @@ public class PApplet implements PConstants { if (platform == MACOSX) { try { final String td = "processing.core.ThinkDifferent"; - final Class thinkDifferent = - Thread.currentThread().getContextClassLoader().loadClass(td); + final Class thinkDifferent = getClass().getClassLoader().loadClass(td); thinkDifferent.getMethod("cleanup").invoke(null); } catch (Exception e) { e.printStackTrace();