From 56a6adc2347b53ff5a5dc016052c6fc07ab76302 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 15 Dec 2008 17:33:50 +0100 Subject: [PATCH] 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. --- PBGitGrapher.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitGrapher.mm b/PBGitGrapher.mm index 087caa3..50e6818 100644 --- a/PBGitGrapher.mm +++ b/PBGitGrapher.mm @@ -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();