fix: crash when using TouchBarScrubber arrow button (#30661)
This commit is contained in:
parent
e43a25724c
commit
32194f0f71
2 changed files with 5 additions and 2 deletions
|
@ -15,7 +15,7 @@ _This class is not exported from the `'electron'` module. It is only available a
|
|||
* `highlightedIndex` Integer - The index of the item the user touched.
|
||||
* `selectedStyle` String (optional) - Selected item style. Can be `background`, `outline` or `none`. Defaults to `none`.
|
||||
* `overlayStyle` String (optional) - Selected overlay item style. Can be `background`, `outline` or `none`. Defaults to `none`.
|
||||
* `showArrowButtons` Boolean (optional) - Defaults to `false`.
|
||||
* `showArrowButtons` Boolean (optional) - Whether to show arrow buttons. Defaults to `false` and is only shown if `items` is non-empty.
|
||||
* `mode` String (optional) - Can be `fixed` or `free`. The default is `free`.
|
||||
* `continuous` Boolean (optional) - Defaults to `true`.
|
||||
|
||||
|
|
|
@ -735,6 +735,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
|||
|
||||
bool showsArrowButtons = false;
|
||||
settings.Get("showArrowButtons", &showsArrowButtons);
|
||||
// The scrubber will crash if the user tries to scroll
|
||||
// and there are no items.
|
||||
if ([self numberOfItemsForScrubber:scrubber] > 0)
|
||||
scrubber.showsArrowButtons = showsArrowButtons;
|
||||
|
||||
std::string selectedStyle;
|
||||
|
|
Loading…
Reference in a new issue