diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-08-11 14:55:27 +0300 |
---|---|---|
committer | patrik <patrik@vaadin.com> | 2015-08-12 16:09:55 +0300 |
commit | 048bd83480551cc4f88dfc9de8e2e17ac6261885 (patch) | |
tree | 233f674bbe3928bd38e951d44ed4bacb68f4109f | |
parent | d92d2367e97f6c221a9559c42e4799988f54d893 (diff) | |
download | vaadin-framework-048bd83480551cc4f88dfc9de8e2e17ac6261885.tar.gz vaadin-framework-048bd83480551cc4f88dfc9de8e2e17ac6261885.zip |
Fix Grid client-side NPE finding uneditable column editor (#18589)
Change-Id: I53e7cb95cf2828f966db5b41c07c38fb756372f3
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 20 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java | 1 |
2 files changed, 16 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 8db6e9a55a..ce3db0970a 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -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; diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java index b77cc41946..e772ed44e9 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java @@ -365,6 +365,7 @@ public class GridEditorTest extends GridBasicFeaturesTest { .findElements(By.xpath("./div")).get(3) .getAttribute("class")); + assertNoErrorNotifications(); } private WebElement getSaveButton() { |