From: Stephen Seo Date: Tue, 19 Nov 2024 12:26:42 +0000 (+0900) Subject: Fix Unit Tests whilst keeping FOREACH working X-Git-Tag: 1.4~7 X-Git-Url: https://git.seodisparate.com/stephenseo/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=5e2ae5f87b62180ebb3a8ef4569559f7c17621c0;p=c_simple_http Fix Unit Tests whilst keeping FOREACH working --- diff --git a/src/http_template.c b/src/http_template.c index 0990cd9..4ab3d0c 100644 --- a/src/http_template.c +++ b/src/http_template.c @@ -1004,17 +1004,19 @@ int c_simple_http_internal_handle_inside_delimeters( // Refers to a variable by name. // Check if ForEach variable. - if (for_state_stack->count != 0 && ((*state) & 0x4) != 0) { - char *value = c_simple_http_internal_get_for_var(for_state_stack, var); - if (value) { - c_simple_http_add_string_part(string_part_list, - value, - html_buf_idx + 1); + if (for_state_stack->count != 0) { + if (((*state) & 0x4) != 0) { + char *value = c_simple_http_internal_get_for_var(for_state_stack, var); + if (value) { + c_simple_http_add_string_part(string_part_list, + value, + html_buf_idx + 1); + return 0; + } + } else if (((*state) & 4) == 0) { + c_simple_http_add_string_part(string_part_list, NULL, html_buf_idx + 1); return 0; } - } else if (((*state) & 4) == 0) { - c_simple_http_add_string_part(string_part_list, NULL, html_buf_idx + 1); - return 0; } C_SIMPLE_HTTP_ConfigValue *config_value =