fix null reference when clicking on Set Item to Top or plugin website

This commit is contained in:
Hongtao Zhang 2022-12-05 12:10:49 -06:00
parent 18451a3069
commit 27726ff1e5
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB

View file

@ -97,17 +97,26 @@ namespace Flow.Launcher
private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (Mouse.DirectlyOver is not FrameworkElement { DataContext: ResultViewModel result })
return;
if (Mouse.DirectlyOver is not FrameworkElement
{
DataContext: ResultViewModel
{
Result:
{
CopyText: { } copyText,
OriginQuery.RawQuery: { } rawQuery
}
}
}) return;
path = result.Result.CopyText;
query = result.Result.OriginQuery.RawQuery;
path = copyText;
query = rawQuery;
start = e.GetPosition(null);
isDragging = true;
}
private void ResultList_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton != MouseButtonState.Pressed|| !isDragging)
if (e.LeftButton != MouseButtonState.Pressed || !isDragging)
{
start = default;
path = string.Empty;
@ -127,7 +136,7 @@ namespace Flow.Launcher
return;
isDragging = false;
var data = new DataObject(DataFormats.FileDrop, new[]
{
path