This commit is contained in:
Looly 2023-08-30 21:57:28 +08:00
parent 5c2a48fee4
commit a3efec9c52

View File

@ -456,12 +456,13 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
}
this.rawList.add(index, InternalJSONUtil.wrap(element, this.config));
} else {
if (!config.isIgnoreNullValue()) {
while (index != this.size()) {
// 非末尾则填充null
this.add(null);
}
}
// issue#3286, 如果用户指定的index太大容易造成Java heap space错误
// if (!config.isIgnoreNullValue()) {
// while (index != this.size()) {
// // 非末尾则填充null
// this.add(null);
// }
// }
this.add(element);
}