Skip to content

Commit a9a7179

Browse files
authored
Merge pull request #1596 from Flow-Launcher/fix_null_reference_contextmenu_item
fix null reference when clicking on Set Item to Top or plugin website
2 parents 51595ad + 27726ff commit a9a7179

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Flow.Launcher/ResultListBox.xaml.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,26 @@ private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
9797

9898
private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
9999
{
100-
if (Mouse.DirectlyOver is not FrameworkElement { DataContext: ResultViewModel result })
101-
return;
102-
103-
path = result.Result.CopyText;
104-
query = result.Result.OriginQuery.RawQuery;
100+
if (Mouse.DirectlyOver is not FrameworkElement
101+
{
102+
DataContext: ResultViewModel
103+
{
104+
Result:
105+
{
106+
CopyText: { } copyText,
107+
OriginQuery.RawQuery: { } rawQuery
108+
}
109+
}
110+
}) return;
111+
112+
path = copyText;
113+
query = rawQuery;
105114
start = e.GetPosition(null);
106115
isDragging = true;
107116
}
108117
private void ResultList_MouseMove(object sender, MouseEventArgs e)
109118
{
110-
if (e.LeftButton != MouseButtonState.Pressed|| !isDragging)
119+
if (e.LeftButton != MouseButtonState.Pressed || !isDragging)
111120
{
112121
start = default;
113122
path = string.Empty;
@@ -127,7 +136,7 @@ private void ResultList_MouseMove(object sender, MouseEventArgs e)
127136
return;
128137

129138
isDragging = false;
130-
139+
131140
var data = new DataObject(DataFormats.FileDrop, new[]
132141
{
133142
path

0 commit comments

Comments
 (0)