Commit 09de383e6e63acb41f89665120f8f9746b637605

Stefan Sperling 2018-12-24T14:18:21

fix crash in blame since 18f4293943894155d5ccbdb423f1e8a2bb1e1d62

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/diff.c b/lib/diff.c
index c7992b7..c89351f 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -104,8 +104,10 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 	args.diff_context = diff_context;
 	flags |= D_PROTOTYPE;
 
-	fprintf(outfile, "blob - %s\n", idstr1);
-	fprintf(outfile, "blob + %s\n", idstr2);
+	if (outfile) {
+		fprintf(outfile, "blob - %s\n", idstr1);
+		fprintf(outfile, "blob + %s\n", idstr2);
+	}
 	err = got_diffreg(&res, f1, f2, flags, &args, &ds, outfile, changes);
 done:
 	if (f1)