From 5a0e432cc299b1034b8427b62a1cb16ed59785ec Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Tue, 8 Nov 2022 12:35:28 +0800 Subject: [PATCH] Fix issue when clipboard is empty --- Flow.Launcher/ViewModel/MainViewModel.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 054347f4f..7c4eb92b8 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -622,7 +622,9 @@ namespace Flow.Launcher.ViewModel { _updateSource?.Cancel(); - if (string.IsNullOrWhiteSpace(QueryText)) + var query = ConstructQuery(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts); + + if (query == null) // shortcut expanded { Results.Clear(); Results.Visbility = Visibility.Collapsed; @@ -631,11 +633,6 @@ namespace Flow.Launcher.ViewModel return; } - var query = ConstructQuery(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts); - - if (query == null) // shortcut expanded - return; - _updateSource?.Dispose(); var currentUpdateSource = new CancellationTokenSource(); @@ -743,6 +740,11 @@ namespace Flow.Launcher.ViewModel private Query ConstructQuery(string queryText, IEnumerable customShortcuts, IEnumerable builtInShortcuts) { + if (string.IsNullOrWhiteSpace(queryText)) + { + return null; + } + StringBuilder queryBuilder = new(queryText); StringBuilder queryBuilderTmp = new(queryText);