aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/com/vaadin/ui/ComboBox.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java
index 0a5a36c856..a976782ecc 100644
--- a/server/src/main/java/com/vaadin/ui/ComboBox.java
+++ b/server/src/main/java/com/vaadin/ui/ComboBox.java
@@ -453,9 +453,18 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
// Must do getItemCaptionGenerator() for each operation since it might
// not be the same as when this method was invoked
setDataProvider(listDataProvider, filterText -> item -> captionFilter
- .test(getItemCaptionGenerator().apply(item), filterText));
+ .test(getItemCaptionOfItem(item), filterText));
}
+ // Helper method for the above to make lambda more readable
+ private String getItemCaptionOfItem(T item) {
+ String caption = getItemCaptionGenerator().apply(item);
+ if (caption == null) {
+ caption = "";
+ }
+ return caption;
+ }
+
/**
* Sets the data items of this listing and a simple string filter with which
* the item string and the text the user has input are compared.