diff --git a/ANAConversationStudio/Helpers/Utilities.cs b/ANAConversationStudio/Helpers/Utilities.cs index b7c2198..c3eaeab 100644 --- a/ANAConversationStudio/Helpers/Utilities.cs +++ b/ANAConversationStudio/Helpers/Utilities.cs @@ -315,6 +315,7 @@ public static Models.ChatFlowSearchItem SearchNode(this ChatNode node, string se } public static bool IsMatch(this string text, string searchKeywords) { + if (string.IsNullOrWhiteSpace(text) || string.IsNullOrWhiteSpace(searchKeywords)) return false; return Regex.IsMatch(text, string.Join("|", searchKeywords.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim())), RegexOptions.IgnoreCase); diff --git a/ANAConversationStudio/ViewModels/MainWindowViewModel.cs b/ANAConversationStudio/ViewModels/MainWindowViewModel.cs index d6f88ad..ab58844 100644 --- a/ANAConversationStudio/ViewModels/MainWindowViewModel.cs +++ b/ANAConversationStudio/ViewModels/MainWindowViewModel.cs @@ -546,6 +546,7 @@ public ObservableCollection SearchResults public void SearchInNodes(string keywords) { + if (string.IsNullOrWhiteSpace(keywords)) return; SearchResults = new ObservableCollection(Network.Nodes.Select(node => node.ChatNode.SearchNode(keywords)).Where(x => x != null)); if (SearchResults.Count == 0) SearchResults = new ObservableCollection