commit c582e516fd9521466f553e16af7cf6185fdb0235
parent 326c0b91ac136447c1cb3f6cc2dc2053f320a5ee
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 23 Jun 2017 12:29:58 +0200
reverse a check to be safer
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -470,7 +470,7 @@ writeblobgph(FILE *fp, const git_blob *blob)
continue;
n++;
fprintf(fp, nfmt, n, n, n);
- for (j = prev; s[j] && j <= i; j++) {
+ for (j = prev; j <= i && s[j]; j++) {
switch (s[j]) {
case '\r': break;
case '\t': fputs(" ", fp); break;
@@ -483,7 +483,7 @@ writeblobgph(FILE *fp, const git_blob *blob)
if ((len - prev) > 0) {
n++;
fprintf(fp, nfmt, n, n, n);
- for (j = prev; s[j] && j < len - prev; j++) {
+ for (j = prev; j < len - prev && s[j]; j++) {
switch (s[j]) {
case '\r': break;
case '\t': fputs(" ", fp); break;