Skip to content

Commit

Permalink
Don't crash when trying to load manifests if their cell is Nothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewNaylor committed Oct 8, 2020
1 parent 9f3b7f1 commit 4571c98
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions guinget/MainWindow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,11 @@ Public Class aaformMainWindow
End Sub

Private Sub datagridviewPackageList_SelectionChanged(sender As Object, e As EventArgs) Handles datagridviewPackageList.SelectionChanged
' Get package details if only one package is selected.
If datagridviewPackageList.SelectedRows.Count = 1 AndAlso IO.File.Exists(datagridviewPackageList.SelectedRows.Item(0).Cells(7).Value.ToString) Then
' Get package details if only one package is selected, if the manifest cell isn't Nothing,
' and the manifest exists. This prevents crashes in case the database is broken.
If datagridviewPackageList.SelectedRows.Count = 1 AndAlso
datagridviewPackageList.SelectedRows.Item(0).Cells(7).Value IsNot Nothing AndAlso
IO.File.Exists(datagridviewPackageList.SelectedRows.Item(0).Cells(7).Value.ToString) Then
' If only one is selected, get its details into the details textbox.
' Set the textbox to say "Loading..." so it doesn't look like it's hanging.
textboxPackageDetails.Text = "Loading, please wait..."
Expand Down

0 comments on commit 4571c98

Please sign in to comment.