GitGrapher: Do not crash on only a single commit

This was somewhat unfortunate, as we don't check
on if we have at least a single parent when adding
new parents. That would cause a wild pointer, or null
dereference when creating a new lane.
This commit is contained in:
Pieter de Bie
2008-12-15 17:33:50 +01:00
parent cbf2608dfa
commit 56a6adc234
+1 -1
View File
@@ -87,7 +87,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
//Add your own parents
// If we already did the first parent, don't do so again
if (!didFirst && currentLanes->size() < MAX_LANES) {
if (!didFirst && currentLanes->size() < MAX_LANES && commit.nParents) {
PBGitLane *newLane = new PBGitLane(commit.parentShas);
currentLanes->push_back(newLane);
newPos = currentLanes->size();