mirror of
https://github.com/electron/electron.git
synced 2026-02-04 04:05:36 -05:00
Verify selectedIndex to prevent NSRangeException
This commit is contained in:
@@ -465,7 +465,8 @@ static NSTouchBarItemIdentifier SegmentedControlIdentifier = @"com.electron.touc
|
||||
|
||||
int selectedIndex = 0;
|
||||
settings.Get("selectedIndex", &selectedIndex);
|
||||
control.selectedSegment = selectedIndex;
|
||||
if (selectedIndex >= 0 && selectedIndex < control.segmentCount)
|
||||
control.selectedSegment = selectedIndex;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user