diff options
Diffstat (limited to 'source/ui-diff.c')
-rw-r--r--source/ui-diff.c11
1 file changed, 7 insertions, 4 deletions
diff --git a/source/ui-diff.c b/source/ui-diff.c
index 8d8e680..33d1751 100644
--- a/source/ui-diff.c
+++ b/source/ui-diff.c
@@ -468,12 +468,15 @@ static void print_diffstat(const struct object_id *old_oid, const struct object_
html("')");
}
html("</div>\n");
- html("<table class='diffstat'>\n");
max_changes = 0;
cgit_diff_tree(old_oid, new_oid, inspect_filepair, prefix, ctx.qry.ignorews);
- for (i = 0; i < files; i++)
- print_fileinfo(&items[i]);
- html("</table>\n");
+ // A change to no files would leave the table an empty frame.
+ if (files) {
+ html("<table class='diffstat'>\n");
+ for (i = 0; i < files; i++)
+ print_fileinfo(&items[i]);
+ html("</table>\n");
+ }
html("<div class='diffstat-summary'>");
htmlf("%d file%s changed, %d insertion%s, %d deletion%s",
files, files == 1 ? "" : "s",