mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix null exception when result is from context menu & Add documents
This commit is contained in:
parent
00de8611e1
commit
95c8475c43
3 changed files with 13 additions and 5 deletions
|
|
@ -12,6 +12,8 @@ namespace Flow.Launcher.Storage
|
|||
|
||||
internal bool IsTopMost(Result result)
|
||||
{
|
||||
// origin query is null when user select the context menu item directly of one item from query list
|
||||
// in this case, we do not need to check if the result is top most
|
||||
if (records.IsEmpty || result.OriginQuery == null ||
|
||||
!records.TryGetValue(result.OriginQuery.RawQuery, out var value))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ namespace Flow.Launcher.Storage
|
|||
|
||||
private static int GenerateQueryAndResultHashCode(Query query, Result result)
|
||||
{
|
||||
// query is null when user select the context menu item directly of one item from query list
|
||||
// so we only need to consider the result
|
||||
if (query == null)
|
||||
{
|
||||
return GenerateResultHashCode(result);
|
||||
|
|
|
|||
|
|
@ -396,11 +396,15 @@ namespace Flow.Launcher.ViewModel
|
|||
})
|
||||
.ConfigureAwait(false);
|
||||
|
||||
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
_userSelectedRecord.Add(result);
|
||||
_history.Add(result.OriginQuery.RawQuery);
|
||||
// origin query is null when user select the context menu item directly of one item from query list
|
||||
// so we don't want to add it to history
|
||||
if (result.OriginQuery != null)
|
||||
{
|
||||
_history.Add(result.OriginQuery.RawQuery);
|
||||
}
|
||||
lastHistoryIndex = 1;
|
||||
}
|
||||
|
||||
|
|
@ -985,9 +989,9 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
List<Result> results;
|
||||
|
||||
results = PluginManager.GetContextMenusForPlugin(selected);
|
||||
results.Add(ContextMenuTopMost(selected));
|
||||
results.Add(ContextMenuPluginInfo(selected.PluginID));
|
||||
results = PluginManager.GetContextMenusForPlugin(selected);
|
||||
results.Add(ContextMenuTopMost(selected));
|
||||
results.Add(ContextMenuPluginInfo(selected.PluginID));
|
||||
|
||||
if (!string.IsNullOrEmpty(query))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue