Guard against missing popover identifier
This commit is contained in:
parent
9c73c991d7
commit
6a22c6645e
1 changed files with 17 additions and 8 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue