Skip to content

Commit

Permalink
Ensure we have a URL to set before setting it
Browse files Browse the repository at this point in the history
Without this, I ran into an error where my code tried to call `Tinycon.reset()` before Tinycon had save the `orginalFavicon` which caused it to try and set the favicon URL to `null`
  • Loading branch information
FiniteLooper committed Jun 18, 2015
1 parent 0c860ee commit 3b5dd1b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tinycon.js
Expand Up @@ -92,13 +92,15 @@
};

var setFaviconTag = function(url){
removeFaviconTag();

var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'icon';
link.href = url;
document.getElementsByTagName('head')[0].appendChild(link);
if(url){
removeFaviconTag();

var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'icon';
link.href = url;
document.getElementsByTagName('head')[0].appendChild(link);
}
};

var log = function(message){
Expand Down

0 comments on commit 3b5dd1b

Please sign in to comment.