]> source.dussan.org Git - vaadin-framework.git/commitdiff
#4250 - IndexedContainer.nextItemId should return null for item ids not in container
authorArtur Signell <artur.signell@itmill.com>
Mon, 1 Mar 2010 15:44:39 +0000 (15:44 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 1 Mar 2010 15:44:39 +0000 (15:44 +0000)
svn changeset:11567/svn branch:6.3

src/com/vaadin/data/util/IndexedContainer.java

index 048d868ee0e5818e81989069a34f9250273cd39d..1d2726cdeb5814840744b02167e2c7c3a5d3f808 100644 (file)
@@ -469,7 +469,13 @@ public class IndexedContainer implements Container.Indexed,
             return null;
         }
         try {
-            return itemIds.get(itemIds.indexOf(itemId) + 1);
+            int idx = itemIds.indexOf(itemId);
+            if (idx == -1) {
+                // If the given Item is not found in the Container,
+                // null is returned.
+                return null;
+            }
+            return itemIds.get(idx + 1);
         } catch (final IndexOutOfBoundsException e) {
             return null;
         }