summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2009-11-19 11:44:46 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-19 23:02:30 -0800
commite42a05f75c9ff5d10d0b8f6784fc244873818a99 (patch)
tree7d3dca9a525b76d5dae38dc4b7ac93261f6b5818 /gitweb
parent63267de2acc18027fc0208c0937fd62b91301fec (diff)
downloadgit-e42a05f75c9ff5d10d0b8f6784fc244873818a99.tar.gz
gitweb.js: fix null object exception in initials calculation
Currently handleLine() assumes that a commit author name will always start with a capital letter. It's possible that the author name is user@example.com and therefore calling a match() on the name will fail to return any matches. Subsequently joining these matches will cause an exception. Fix by checking that we have a match before trying to join the results into a set of initials for the author. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rw-r--r--gitweb/gitweb.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/gitweb/gitweb.js b/gitweb/gitweb.js
index 91b766e336..f1ba9ae52b 100644
--- a/gitweb/gitweb.js
+++ b/gitweb/gitweb.js
@@ -566,8 +566,11 @@ function handleLine(commit, group) {
if (group.numlines >= 2) {
var fragment = document.createDocumentFragment();
var br = document.createElement("br");
- var text = document.createTextNode(
- commit.author.match(/\b([A-Z])\B/g).join(''));
+ var match = commit.author.match(/\b([A-Z])\B/g);
+ if (match) {
+ var text = document.createTextNode(
+ match.join(''));
+ }
if (br && text) {
var elem = fragment || td_sha1;
elem.appendChild(br);