diff --git a/inject.html b/inject.html
index d20af16..38d3a28 100644
--- a/inject.html
+++ b/inject.html
@@ -21,8 +21,9 @@
$( document ).ready(function() {
$('a').each(function(idx, el){
- if($(el).attr('href').match("magnet:?")){
- $(el).before('
')
+ var $el = $(el);
+ if($el.attr('href') && $el.attr('href').match("magnet:?")){
+ $el.before('
')
}
})