Permalink
Browse files

When removing a DOM element, ensure element exists before calling

methods on it.

Fixes #14
  • Loading branch information...
1 parent 61afe92 commit bf56c69b1d5cf2e7a42e8aa810943e8ddea5cf33 @jdhuntington jdhuntington committed with JD Huntington Feb 26, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 tinycon.js
View
@@ -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]);
}
}

0 comments on commit bf56c69

Please sign in to comment.