summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-13 11:20:44 -0400
committerJune McEnroe <june@causal.agency>2020-04-13 11:20:44 -0400
commita0423730e77803a95fb52ba67856b52221a246ae (patch)
treeaa97e81dd34b7e0fd8a7a3aa31510710c545c89a
parentConcatenate HTML threads (diff)
downloadbubger-a0423730e77803a95fb52ba67856b52221a246ae.tar.gz
bubger-a0423730e77803a95fb52ba67856b52221a246ae.zip
Fix concatHTML thread nesting
-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;
 	}