harlam357 / hfm-net

Client Monitoring Application for Folding@Home
34 stars 6 forks source link

Exception in Benchmarks Viewer when not selecting an item in the ListBox #328

Closed uyaem closed 4 years ago

uyaem commented 4 years ago

Description When clicking in the ListBox on the left side of Benchmarks Viewer, in the "empty part" where no project IDs are listed, the following exception is thrown:

Exception

HFM.NET v0.9.17.1040

Microsoft Windows NT 6.2.9200.0

Exception Thrown:
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei HFM.Forms.BenchmarksForm.listBox1_SelectedIndexChanged(Object sender, EventArgs e)
   bei System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   bei System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
   bei System.Windows.Forms.ListBox.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Steps to reproduce

Classic NPE, method listBox1_SelectedIndexChanged is missing a null check for SelectedItem.

harlam357 commented 4 years ago

Nice find! Fixed in master and available in next release.