Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Fix exception being thrown by favicon library when a URL doesn't have…
Browse files Browse the repository at this point in the history
… a host (eg. `about:blank`)
  • Loading branch information
josh- committed Mar 13, 2018
1 parent c661b06 commit cc13588
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions CloudyTabs/JPAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ @interface JPAppDelegate ()

@implementation JPAppDelegate

const NSSize ICON_SIZE = {19, 19};

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
if ([JPCloudTabsDBReader canReadFile]) {
Expand Down Expand Up @@ -221,14 +223,17 @@ - (void)updateMenu

tabMenuItem.representedObject = URL;
tabMenuItem.toolTip = URL.relativeString;

__block NSImage *image = [[DSFavIconManager sharedInstance] iconForURL:tabMenuItem.representedObject downloadHandler:^(NSImage *icon) {
icon.size = NSMakeSize(19, 19);
[tabMenuItem setImage:icon];
}];
image.size = NSMakeSize(19, 19);
[tabMenuItem setImage:image];


if (URL.host != nil) {
tabMenuItem.image = [[DSFavIconManager sharedInstance] iconForURL:tabMenuItem.representedObject downloadHandler:^(NSImage *image) {
image.size = ICON_SIZE;
tabMenuItem.image = image;
}];
} else {
tabMenuItem.image = [DSFavIconManager sharedInstance].placeholder;
}
tabMenuItem.image.size = ICON_SIZE;

[self.menu addItem:tabMenuItem];
}
}
Expand Down

0 comments on commit cc13588

Please sign in to comment.