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:
@@ -406,8 +406,12 @@ public class ListUtil
|
|||||||
*/
|
*/
|
||||||
public static Object remove (Object[] list, int index)
|
public static Object remove (Object[] list, int index)
|
||||||
{
|
{
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int llength = list.length;
|
int llength = list.length;
|
||||||
if (list == null || llength <= index || index < 0) {
|
if (llength <= index || index < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user