From 79af7621e99d601012cb7533d3d151a5df16df64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1o=20Petrovi=C4=8D?= Date: Thu, 23 Nov 2017 12:51:31 +0100 Subject: [PATCH] Update MaterialComboBox.java Null can be a valid value and should not be ignored. --- .../addins/client/combobox/MaterialComboBox.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java index d306e1bb6..568d5937a 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java @@ -520,13 +520,13 @@ public int getValueIndex(T value) { */ public void setSelectedIndex(int selectedIndex) { this.selectedIndex = selectedIndex; - if (values.size() > 0) { + if (values.size() > selectedIndex) { T value = values.get(selectedIndex); if (value != null) { $(listbox.getElement()).val(keyFactory.generateKey(value)).trigger("change.select2", selectedIndex); - } else { - GWT.log("Value index is not found.", new IndexOutOfBoundsException()); - } + } + } else { + GWT.log("Value index is not found.", new IndexOutOfBoundsException()); } } @@ -689,4 +689,4 @@ public ReadOnlyMixin getReadOnlyMixin() { } return readOnlyMixin; } -} \ No newline at end of file +}