Skip to content

Commit

Permalink
When removing a DOM element, ensure element exists before calling
Browse files Browse the repository at this point in the history
methods on it.

Fixes tommoor#14
  • Loading branch information
jdhuntington authored and JD Huntington committed Feb 26, 2012
1 parent 61afe92 commit bf56c69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tinycon.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
var head = document.getElementsByTagName('head')[0];

for(var i=0, len=links.length; i < len; i++) {
if (links[i].getAttribute('rel') === 'icon') {
var exists = (typeof(links[i]) !== 'undefined');
if (exists && links[i].getAttribute('rel') === 'icon') {
head.removeChild(links[i]);
}
}
Expand Down

0 comments on commit bf56c69

Please sign in to comment.