Prevent NPE when operating on a null list. A null list should be treated as an

empty list.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1785 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-02-15 23:15:58 +00:00
parent f6f7f3f773
commit 85b6a76cf2
+5 -1
View File
@@ -406,8 +406,12 @@ public class ListUtil
*/
public static Object remove (Object[] list, int index)
{
if (list == null) {
return null;
}
int llength = list.length;
if (list == null || llength <= index || index < 0) {
if (llength <= index || index < 0) {
return null;
}