Skip to content

Commit 83de84e

Browse files
committed
make sure there are elements in details
1 parent ec199cc commit 83de84e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

coderstats/data/coderstats.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ if (m = path.match(/^\/([\w-]+)\??.*?/)) {
44
if (-1 === ['timeline', 'languages', 'blog', 'explore'].indexOf(login)) {
55
var url = 'http://coderstats.net/github/' + login.trim() + '/';
66
var details = document.getElementsByClassName('details');
7-
var dl = document.createElement('dl');
8-
dl.innerHTML = '<dt><span class="octicon octicon-link"></span></dt><dd><a href="' + url + '">CoderStats(\'' + login + '\')</a></dd>';
9-
details[0].appendChild(dl);
7+
if (details.length > 0) {
8+
var dl = document.createElement('dl');
9+
dl.innerHTML = '<dt><span class="octicon octicon-link"></span></dt><dd><a href="' + url + '">CoderStats(\'' + login + '\')</a></dd>';
10+
details[0].appendChild(dl);
11+
}
1012
}
1113
}

coderstats/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Display a link to the CoderStats page for the currently displayed GitHub user when browsing github.com.",
66
"author": "CoderStats",
77
"license": "MIT",
8-
"version": "0.1",
8+
"version": "0.2",
99
"homepage": "http://coderstats.net/",
1010
"icon64": "static/logo-64x64.png"
11-
}
11+
}

0 commit comments

Comments
 (0)