From: Tollef Fog Heen Date: Sun, 2 Oct 2011 19:19:11 +0000 (+0200) Subject: Avoid running off a cliff when we get to the end of the list of files X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29ad4d88cb53cd2997c3787e3436cf1ba7d5ec19;p=gant Avoid running off a cliff when we get to the end of the list of files --- diff --git a/fr60.c b/fr60.c index 35b84b9..9061a4f 100644 --- a/fr60.c +++ b/fr60.c @@ -666,7 +666,7 @@ chevent(uchar chan, uchar event) downloadingfilenum++; } } - if (downloadingfilenum == antfsdir_used) { + if (downloadingfilenum >= antfsdir_used) { printf("No files to download"); } else { D("downloading first file (%d)\n", antfsdir[downloadingfilenum].fileno); @@ -681,7 +681,8 @@ chevent(uchar chan, uchar event) downloadfinished = 1; } else { downloadingfilenum++; - while (! interesting_file(&antfsdir[downloadingfilenum], antfsdir_used)) { + while (downloadingfilenum < antfsdir_used && + ! interesting_file(&antfsdir[downloadingfilenum], antfsdir_used)) { D("Skipping %d; not .fit file\n", downloadingfilenum); downloadingfilenum++; }