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
This commit is contained in:
Jeremy Wu 2022-12-06 08:27:09 +11:00 committed by GitHub
commit a9a7179b44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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