mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+1
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user