Skip to content

Commit 5f97caa

Browse files
author
Pieter de Bie
committed
HistoryView: only add parents if parents array exists
This used to break if a commit had no parents. This wasn't noticed before because the breakage is only minor -- the only way you see it is because the detail view didn't scroll up afterwards.
1 parent 60908fd commit 5f97caa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

html/views/history/history.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,18 @@ var loadCommit = function(commitObject, currentRef) {
184184
}
185185
}
186186

187+
// Scroll to top
188+
scroll(0, 0);
189+
190+
if (!commit.parents)
191+
return;
192+
187193
for (var i = 0; i < commit.parents.length; i++) {
188194
var newRow = $("commit_header").insertRow(-1);
189195
newRow.innerHTML = "<td class='property_name'>Parent:</td><td>" +
190196
"<a href='' onclick='selectCommit(this.innerHTML); return false;'>" +
191197
commit.parents[i] + "</a></td>";
192198
}
193-
194-
// Scroll to top
195-
scroll(0, 0);
196199
}
197200

198201
var showDiff = function() {

0 commit comments

Comments
 (0)