Author: ivaynberg Date: Sat Mar 8 12:44:09 2008 New Revision: 635083 URL: http://svn.apache.org/viewvc?rev=635083&view=rev Log: WICKET-1383: MiniMap IndexOutOfBoundsException when empty
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/collections/MiniMap.java Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/collections/MiniMap.java URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/collections/MiniMap.java?rev=635083&r1=635082&r2=635083&view=diff ============================================================================== --- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/collections/MiniMap.java (original) +++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/collections/MiniMap.java Sat Mar 8 12:44:09 2008 @@ -437,17 +437,20 @@ */ private int findKey(final Object key) { - // Find key starting at search index - final int index = findKey(lastSearchIndex, key); - - // Found match? - if (index != -1) + if (size > 0) { - // Start search at the next index next time - lastSearchIndex = nextIndex(index); + // Find key starting at search index + final int index = findKey(lastSearchIndex, key); + + // Found match? + if (index != -1) + { + // Start search at the next index next time + lastSearchIndex = nextIndex(index); - // Return index of key - return index; + // Return index of key + return index; + } } return -1;