mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Guard against missing popover identifier
This commit is contained in:
@@ -165,18 +165,27 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||
std::string item_type;
|
||||
settings.Get("type", &item_type);
|
||||
|
||||
NSTouchBarItemIdentifier identifier = [self identifierFromID:item_id
|
||||
type:item_type];
|
||||
auto identifier = [self identifierFromID:item_id type:item_type];
|
||||
if (!identifier) return;
|
||||
|
||||
std::vector<std::string> popover_ids;
|
||||
if (settings.Get("_popover", &popover_ids)) {
|
||||
for (auto& popover_id : popover_ids) {
|
||||
NSPopoverTouchBarItem* popoverItem = [touchBar itemForIdentifier:[self identifierFromID:popover_id type:"popover"]];
|
||||
[self refreshTouchBarItem:popoverItem.popoverTouchBar id:identifier withType:item_type withSettings:settings];
|
||||
}
|
||||
settings.Get("_popover", &popover_ids);
|
||||
for (auto& popover_id : popover_ids) {
|
||||
auto popoverIdentifier = [self identifierFromID:popover_id type:"popover"];
|
||||
if (!popoverIdentifier) continue;
|
||||
|
||||
NSPopoverTouchBarItem* popoverItem =
|
||||
[touchBar itemForIdentifier:popoverIdentifier];
|
||||
[self refreshTouchBarItem:popoverItem.popoverTouchBar
|
||||
id:identifier
|
||||
withType:item_type
|
||||
withSettings:settings];
|
||||
}
|
||||
[self refreshTouchBarItem:touchBar id:identifier withType:item_type withSettings:settings];
|
||||
|
||||
[self refreshTouchBarItem:touchBar
|
||||
id:identifier
|
||||
withType:item_type
|
||||
withSettings:settings];
|
||||
}
|
||||
|
||||
- (void)buttonAction:(id)sender {
|
||||
|
||||
Reference in New Issue
Block a user