Skip to content

Commit

Permalink
Fix crash on Images grid path cell click
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostiantyn Cherniavskyi committed Aug 3, 2024
1 parent cb6fd54 commit 29b21b1
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/Mi899/MotherboardPartialForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,24 @@ private async void grd_PathCellContentClick(object sender, DataGridViewCellEvent
return;
}

GenericBindingList<BiosRowData> list = (GenericBindingList<BiosRowData>)grdBioses.DataSource;
BiosRowData bios = list[e.RowIndex];
Cursor.Current = Cursors.WaitCursor;

if (bios.IsCommercial)
if (grid.DataSource is GenericBindingList<BiosRowData> list)
{
UrlManager.OpenUrl(bios.DownloadUrl);
return;
}
BiosRowData bios = list[e.RowIndex];

Cursor.Current = Cursors.WaitCursor;
if (bios.IsCommercial)
{
UrlManager.OpenUrl(bios.DownloadUrl);
Cursor = Cursors.Default;
return;
}

if (!await _biosManager.DownloadBiosIfMissingAsync(bios))
{
Cursor = Cursors.Default;
return;
if (!await _biosManager.DownloadBiosIfMissingAsync(bios))
{
Cursor = Cursors.Default;
return;
}
}

string path = grid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value?.ToString();
Expand Down

0 comments on commit 29b21b1

Please sign in to comment.