From cdaaf12557f7086657d5a0c34e565b1773c9834a Mon Sep 17 00:00:00 2001 From: Douglas Crockford Date: Fri, 18 Apr 2014 16:16:03 -0700 Subject: [PATCH] JSONArray.remove --- JSONArray.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/JSONArray.java b/JSONArray.java index 673a919..e0af8fa 100644 --- a/JSONArray.java +++ b/JSONArray.java @@ -75,7 +75,7 @@ import java.util.Map; * * * @author JSON.org - * @version 2013-04-18 + * @version 2014-04-18 */ public class JSONArray { @@ -814,7 +814,9 @@ public class JSONArray { */ public Object remove(int index) { Object o = this.opt(index); - this.myArrayList.remove(index); + if (index >= 0 && index < this.length()) { + this.myArrayList.remove(index); + } return o; }