Skip to content

Commit 80f54ba

Browse files
committed
Fix more possible origin query null exception & Remove useless load function
1 parent 95c8475 commit 80f54ba

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Flow.Launcher/Storage/TopMostRecord.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,25 @@ internal bool IsTopMost(Result result)
2626

2727
internal void Remove(Result result)
2828
{
29+
// origin query is null when user select the context menu item directly of one item from query list
30+
// in this case, we do not need to remove the record
31+
if (result.OriginQuery == null)
32+
{
33+
return;
34+
}
35+
2936
records.Remove(result.OriginQuery.RawQuery, out _);
3037
}
3138

3239
internal void AddOrUpdate(Result result)
3340
{
41+
// origin query is null when user select the context menu item directly of one item from query list
42+
// in this case, we do not need to add or update the record
43+
if (result.OriginQuery == null)
44+
{
45+
return;
46+
}
47+
3448
var record = new Record
3549
{
3650
PluginID = result.PluginID,
@@ -39,11 +53,6 @@ internal void AddOrUpdate(Result result)
3953
};
4054
records.AddOrUpdate(result.OriginQuery.RawQuery, record, (key, oldValue) => record);
4155
}
42-
43-
public void Load(Dictionary<string, Record> dictionary)
44-
{
45-
records = new ConcurrentDictionary<string, Record>(dictionary);
46-
}
4756
}
4857

4958
public class Record

0 commit comments

Comments
 (0)