From e9414ef2b02a7ea28c52b2fee3f699b1b462425f Mon Sep 17 00:00:00 2001 From: Khaja Nizamuddin Date: Wed, 30 Aug 2017 06:10:27 +0530 Subject: [PATCH] Search for empty Name or Alias entities fixed --- ANAConversationStudio/Helpers/Utilities.cs | 1 + ANAConversationStudio/ViewModels/MainWindowViewModel.cs | 1 + 2 files changed, 2 insertions(+) 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