Piotrekol / StreamCompanion

osu! information extractor, ranging from selected map info to live play data
MIT License
369 stars 59 forks source link

add error handling for gamma range outside 0-100 #376

Closed Epikest closed 1 year ago

Epikest commented 1 year ago

currently, it will just crash if you try to use settings from an older version of StreamCompanion

ArgumentOutOfRangeException: Value of '105' is not valid for 'Value'. 'Value' should be between 'Minimum' and '$Maximum'. (Parameter 'value')
Actual value was 105.
   at System.Windows.Forms.TrackBar.set_Value(Int32 value)
   at Gamma.GammaSettings.PopulateForm(GammaRange gammaRange)
   at Gamma.GammaSettings.listBox_gammaRanges_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

image image

Piotrekol commented 1 year ago

Shouldn't be possible if user didn't edit their settings.ini manually - previous range was 0.228 - 4.46 which was mapped to 100 - 0

I guess clamping the value on conversion wouldn't hurt