From c32a723e2906de3741bf5abd95234e7efdb1703b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 18 Apr 2017 08:58:54 -0700 Subject: [PATCH] Only read iconPosition when icon is present --- atom/browser/ui/cocoa/atom_touch_bar.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_touch_bar.mm b/atom/browser/ui/cocoa/atom_touch_bar.mm index 97eebf73f688..a21fbc5497a3 100644 --- a/atom/browser/ui/cocoa/atom_touch_bar.mm +++ b/atom/browser/ui/cocoa/atom_touch_bar.mm @@ -307,17 +307,18 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item"; settings.Get("label", &label); button.title = base::SysUTF8ToNSString(label); - std::string iconPosition = "overlay"; - settings.Get("iconPosition", &iconPosition); gfx::Image image; if (settings.Get("icon", &image)) { button.image = image.AsNSImage(); + + std::string iconPosition; + settings.Get("iconPosition", &iconPosition); if (iconPosition == "left") { - button.imagePosition = NSImageLeft; + button.imagePosition = NSImageLeft; } else if (iconPosition == "right") { - button.imagePosition = NSImageRight; + button.imagePosition = NSImageRight; } else { - button.imagePosition = NSImageOverlaps; + button.imagePosition = NSImageOverlaps; } } }