From 85b6a76cf2f618b9e00c80238da0f2f884232986 Mon Sep 17 00:00:00 2001 From: mdb Date: Wed, 15 Feb 2006 23:15:58 +0000 Subject: [PATCH] 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 --- src/java/com/samskivert/util/ListUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/com/samskivert/util/ListUtil.java b/src/java/com/samskivert/util/ListUtil.java index 04d7b9b0..bd1b48a9 100644 --- a/src/java/com/samskivert/util/ListUtil.java +++ b/src/java/com/samskivert/util/ListUtil.java @@ -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; }