From 8b34e6652078a8b02f037e877c82dc3327bf181f Mon Sep 17 00:00:00 2001 From: Paco Date: Tue, 20 Jun 2017 20:28:42 -0300 Subject: [PATCH 1/2] make "loadXML(String)" handle "file not found" when file is not found, a null pointer exception crashes processing i guess is because this line --- core/src/processing/core/PApplet.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index a74383910..1b899361a 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -5921,7 +5921,9 @@ public class PApplet implements PConstants { */ public XML loadXML(String filename, String options) { try { - return new XML(createReader(filename), options); + BufferedReader br = createReader(filename); + if (br != null) return new XML(br, options); + else br = null; // can't use catch-all exception, since it might catch the // RuntimeException about the incorrect case sensitivity From 6edf2a5215ff74fc3d13bd3cf4562de6f2128c30 Mon Sep 17 00:00:00 2001 From: Paco Date: Tue, 20 Jun 2017 20:41:50 -0300 Subject: [PATCH 2/2] styling fix just read how to style correctly --- core/src/processing/core/PApplet.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 1b899361a..f046d50cf 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -5922,8 +5922,11 @@ public class PApplet implements PConstants { public XML loadXML(String filename, String options) { try { BufferedReader br = createReader(filename); - if (br != null) return new XML(br, options); - else br = null; + if (br != null) { + return new XML(br, options); + } else { + br = null; + } // can't use catch-all exception, since it might catch the // RuntimeException about the incorrect case sensitivity