summaryrefslogtreecommitdiff
path: root/file
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-29 01:54:27 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-08-29 01:54:27 (GMT)
commitd6df803b702a3a6e42cd1368f38e284cf9c9d071 (patch)
tree6c013e1b498c7aa467e2105782969e2eda90081b /file
parentf06dcc85cf74173560579c42d7de23b10aa8d99a (diff)
downloadeeshow-d6df803b702a3a6e42cd1368f38e284cf9c9d071.zip
eeshow-d6df803b702a3a6e42cd1368f38e284cf9c9d071.tar.gz
eeshow-d6df803b702a3a6e42cd1368f38e284cf9c9d071.tar.bz2
file/git-hist.c (dump_one): don't overrun sorted_hist
I did try to do it right, but didn't ...
Diffstat (limited to 'file')
-rw-r--r--file/git-hist.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/file/git-hist.c b/file/git-hist.c
index 113f3c5..c91d816 100644
--- a/file/git-hist.c
+++ b/file/git-hist.c
@@ -682,11 +682,12 @@ static void dump_one(void *user, struct vcs_hist *h)
pfatal_git("git_object_short_id");
next = NULL;
- for (i = 0; i < history->n_hist; i++)
- if (history->sorted_hist[i] == h) {
- next = history->sorted_hist[i + 1];
- break;
- }
+ if (history->n_hist)
+ for (i = 0; i != history->n_hist - 1; i++)
+ if (history->sorted_hist[i] == h) {
+ next = history->sorted_hist[i + 1];
+ break;
+ }
#ifdef DEBUG
fprintf(stderr, "%p (%u/%u):", h, h->n_newer, h->n_older);
for (i = 0; i != h->n_threads; i++)