fixed index out of range exception in CECSettingNumeric.cs. bugzid: 2082
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 8 Mar 2013 10:27:37 +0000 (11:27 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 8 Mar 2013 12:51:47 +0000 (13:51 +0100)
src/LibCecTray/settings/CECSettingNumeric.cs

index 44f856a0681c9142a1fbeab362779fd235f55099..903891536b55fdddd972d56131c5412d89ab4c58 100644 (file)
@@ -158,10 +158,13 @@ namespace LibCECTray.settings
 
       ResetItems(BaseItems.Count == 0);
 
-      control.SelectedValueChanged += delegate
-                                        {
-                                          Value = BaseItems[control.SelectedIndex];
-                                        };
+      if (BaseItems.Count > 0 && control.SelectedIndex < BaseItems.Count)
+      {
+        control.SelectedValueChanged += delegate
+                                          {
+                                            Value = BaseItems[control.SelectedIndex];
+                                          };
+      }
     }
 
     public override Control ValueControl