mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix more possible origin query null exception & Remove useless load function
This commit is contained in:
parent
95c8475c43
commit
80f54ba0de
1 changed files with 14 additions and 5 deletions
|
|
@ -26,11 +26,25 @@ namespace Flow.Launcher.Storage
|
|||
|
||||
internal void Remove(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 remove the record
|
||||
if (result.OriginQuery == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
records.Remove(result.OriginQuery.RawQuery, out _);
|
||||
}
|
||||
|
||||
internal void AddOrUpdate(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 add or update the record
|
||||
if (result.OriginQuery == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var record = new Record
|
||||
{
|
||||
PluginID = result.PluginID,
|
||||
|
|
@ -39,11 +53,6 @@ namespace Flow.Launcher.Storage
|
|||
};
|
||||
records.AddOrUpdate(result.OriginQuery.RawQuery, record, (key, oldValue) => record);
|
||||
}
|
||||
|
||||
public void Load(Dictionary<string, Record> dictionary)
|
||||
{
|
||||
records = new ConcurrentDictionary<string, Record>(dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
public class Record
|
||||
|
|
|
|||
Loading…
Reference in a new issue