Permalink
Browse files

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.
  • Loading branch information...
1 parent cbf2608 commit 56a6adc2347b53ff5a5dc016052c6fc07ab76302 @pieter pieter committed Dec 15, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 PBGitGrapher.mm
View
@@ -87,7 +87,7 @@ - (void) decorateCommit: (PBGitCommit *) commit
//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();

0 comments on commit 56a6adc

Please sign in to comment.