mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Make parseJSONObject/Array return null when parsing fails
This commit is contained in:
@@ -5629,7 +5629,12 @@ public class PApplet implements PConstants {
|
||||
* @see PApplet#saveJSONObject(JSONObject, String)
|
||||
*/
|
||||
public JSONObject parseJSONObject(String input) {
|
||||
return new JSONObject(new StringReader(input));
|
||||
try {
|
||||
return new JSONObject(new StringReader(input));
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5741,7 +5746,12 @@ public class PApplet implements PConstants {
|
||||
* @see PApplet#saveJSONObject(JSONObject, String)
|
||||
*/
|
||||
public JSONArray parseJSONArray(String input) {
|
||||
return new JSONArray(new StringReader(input));
|
||||
try {
|
||||
return new JSONArray(new StringReader(input));
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ X https://github.com/processing/processing4/pull/183
|
||||
X calling unregisterMethod() on dispose from dispose() means concurrent mod
|
||||
o https://github.com/processing/processing4/pull/199
|
||||
X modernized the code a bit, checked in a version that queues to avoid list issue
|
||||
X Make parseJSONObject/Array return null when parsing fails
|
||||
X https://github.com/processing/processing4/issues/165
|
||||
X https://github.com/processing/processing4/pull/166
|
||||
|
||||
|
||||
_ cursor(PImage) broken everywhere because PImage.getNative() returns null
|
||||
|
||||
Reference in New Issue
Block a user