]> Lady’s Gitweb - Gitweb/commitdiff
gitweb.js: fix null object exception in initials calculation
authorStephen Boyd <redacted>
Thu, 19 Nov 2009 19:44:46 +0000 (11:44 -0800)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
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 <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.js

index d1b64b2aa2b83e1ef875c35bdef23796021fb3398c33e2c07680bd9389be8bb9..1b0d1f98bc41e339031faf94eade3e778b38d6b5a74bb11cb0b136a9ab801300 100644 (file)
--- a/gitweb.js
+++ b/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);
This page took 0.259995 seconds and 4 git commands to generate.