Fix issue when clipboard is empty

This commit is contained in:
Vic 2022-11-08 12:35:28 +08:00
parent 903aec57c1
commit 5a0e432cc2

View file

@ -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<CustomShortcutModel> customShortcuts, IEnumerable<BuiltinShortcutModel> builtInShortcuts)
{
if (string.IsNullOrWhiteSpace(queryText))
{
return null;
}
StringBuilder queryBuilder = new(queryText);
StringBuilder queryBuilderTmp = new(queryText);