Skip to content

Commit cdaaf12

Browse files
JSONArray.remove
1 parent 4d86b05 commit cdaaf12

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

JSONArray.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ of this software and associated documentation files (the "Software"), to deal
7575
* </ul>
7676
*
7777
* @author JSON.org
78-
* @version 2013-04-18
78+
* @version 2014-04-18
7979
*/
8080
public class JSONArray {
8181

@@ -814,7 +814,9 @@ public JSONArray put(int index, Object value) throws JSONException {
814814
*/
815815
public Object remove(int index) {
816816
Object o = this.opt(index);
817-
this.myArrayList.remove(index);
817+
if (index >= 0 && index < this.length()) {
818+
this.myArrayList.remove(index);
819+
}
818820
return o;
819821
}
820822

0 commit comments

Comments
 (0)