diff --git a/projects/samskivert/src/java/com/samskivert/util/ListUtil.java b/projects/samskivert/src/java/com/samskivert/util/ListUtil.java index 3e29013b..e9b37c17 100644 --- a/projects/samskivert/src/java/com/samskivert/util/ListUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/ListUtil.java @@ -1,5 +1,5 @@ // -// $Id: ListUtil.java,v 1.11 2002/12/12 00:29:39 mdb Exp $ +// $Id: ListUtil.java,v 1.12 2003/07/15 00:31:54 ray Exp $ package com.samskivert.util; @@ -308,11 +308,13 @@ public class ListUtil protected static int indexOf ( EqualityComparator eqc, Object[] list, Object element) { - int llength = list.length; // no optimizing bastards - for (int i = 0; i < llength; i++) { - Object elem = list[i]; - if (eqc.equals(elem, element)) { - return i; + if (list != null) { + int llength = list.length; // no optimizing bastards + for (int i = 0; i < llength; i++) { + Object elem = list[i]; + if (eqc.equals(elem, element)) { + return i; + } } } return -1; diff --git a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java index a407f408..9f44353d 100644 --- a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java +++ b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java @@ -1,5 +1,5 @@ // -// $Id: SortableArrayList.java,v 1.15 2003/07/15 00:30:30 ray Exp $ +// $Id: SortableArrayList.java,v 1.16 2003/07/15 00:31:54 ray Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -237,10 +237,6 @@ public class SortableArrayList extends AbstractList // documentation inherited from interface public int indexOf (Object o) { - if (_elements == null) { - return -1; - } - return ListUtil.indexOfEqual(_elements, o); }