]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix Grid client-side NPE finding uneditable column editor (#18589)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 11 Aug 2015 11:55:27 +0000 (14:55 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 11 Aug 2015 13:05:01 +0000 (16:05 +0300)
Change-Id: I6f3fc25785bc6036795a791d6582c3d9194b505c

client/src/com/vaadin/client/widgets/Grid.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java

index 8db6e9a55ab4c99952fc93f33985f32989a175f8..ce3db0970a14114e388109f4d42e32637f8e6570 100644 (file)
@@ -6745,11 +6745,21 @@ public class Grid<T> extends ResizeComposite implements
 
         if (args.getIndicesLength() == 0) {
             return editor.editorOverlay;
-        } else if (args.getIndicesLength() == 1
-                && args.getIndex(0) < columns.size()) {
-            escalator
-                    .scrollToColumn(args.getIndex(0), ScrollDestination.ANY, 0);
-            return editor.getWidget(columns.get(args.getIndex(0))).getElement();
+        } else if (args.getIndicesLength() == 1) {
+            int index = args.getIndex(0);
+            if (index >= columns.size()) {
+                return null;
+            }
+
+            escalator.scrollToColumn(index, ScrollDestination.ANY, 0);
+            Widget widget = editor.getWidget(columns.get(index));
+
+            if (widget != null) {
+                return widget.getElement();
+            }
+
+            // No widget for the column.
+            return null;
         }
 
         return null;
index b77cc419466de58eff3c1097ad338879fccedb7a..e772ed44e91a918664c356f29f34d0fab0ef505a 100644 (file)
@@ -365,6 +365,7 @@ public class GridEditorTest extends GridBasicFeaturesTest {
                         .findElements(By.xpath("./div")).get(3)
                         .getAttribute("class"));
 
+        assertNoErrorNotifications();
     }
 
     private WebElement getSaveButton() {