diff --git a/gemsfx/src/main/java/com/dlsc/gemsfx/SearchField.java b/gemsfx/src/main/java/com/dlsc/gemsfx/SearchField.java index e4378355..9476b523 100644 --- a/gemsfx/src/main/java/com/dlsc/gemsfx/SearchField.java +++ b/gemsfx/src/main/java/com/dlsc/gemsfx/SearchField.java @@ -406,7 +406,7 @@ public void commit() { private void addToHistory(String text) { HistoryManager historyManager = getHistoryManager(); - if (historyManager != null) { + if (historyManager != null && StringUtils.isNotBlank(text)) { historyManager.add(text); } } diff --git a/gemsfx/src/main/java/com/dlsc/gemsfx/SearchTextField.java b/gemsfx/src/main/java/com/dlsc/gemsfx/SearchTextField.java index 5cd30309..1762652a 100644 --- a/gemsfx/src/main/java/com/dlsc/gemsfx/SearchTextField.java +++ b/gemsfx/src/main/java/com/dlsc/gemsfx/SearchTextField.java @@ -84,7 +84,10 @@ public SearchTextField() { private void addToHistory() { HistoryManager historyManager = getHistoryManager(); if (historyManager != null) { - historyManager.add(getText()); + String text = getText(); + if (StringUtils.isNotBlank(text)) { + historyManager.add(text); + } } }