summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--concat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/concat.c b/concat.c
index 6d0e507..07d1f6f 100644
--- a/concat.c
+++ b/concat.c
@@ -81,17 +81,17 @@ static int concatHTML(FILE *file, struct List thread) {
 	static char path[PATH_MAX];
 	int error;
 	for (size_t i = 0; i < thread.len; ++i) {
-		error = htmlThreadOpen(file);
-		if (error) return error;
 		if (thread.ptr[i].type == List) {
 			error = concatHTML(file, thread.ptr[i].list);
 		} else {
 			uint32_t uid = dataCheck(thread.ptr[i], Number).number;
-			error = concatFile(file, pathUID(path, uid, "html"));
+			error = htmlThreadOpen(file)
+				|| concatFile(file, pathUID(path, uid, "html"));
 		}
 		if (error) return error;
 	}
 	for (size_t i = 0; i < thread.len; ++i) {
+		if (thread.ptr[i].type == List) continue;
 		error = htmlThreadClose(file);
 		if (error) return error;
 	}