From c44ce35e930a52aad0632c2db74f24144a48d572 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 1 Dec 2026 22:23:08 +0800 Subject: Fix ternary condition to include is_mtl too and not just the last delimiter, just like one of the only 2 possible conditions below it. --- converter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'converter.c') diff --git a/converter.c b/converter.c index ded4f5d..d6a18f7 100644 --- a/converter.c +++ b/converter.c @@ -15,8 +15,9 @@ static void read_file(void *ctx, const char *filename, const int is_mtl, const c '/' #endif ); - char path[strlen(obj_filename) - (last_delim ? strlen(last_delim) + 1 : 0) + 1]; - if (is_mtl && last_delim) { + _Bool is_mtl_last_delim = is_mtl && last_delim; + char path[strlen(obj_filename) - (is_mtl_last_delim ? strlen(last_delim) + 1 : 0) + 1]; + if (is_mtl_last_delim) { last_delim[0] = '\0'; sprintf(path, "%s/%s", obj_filename, filename); } else -- cgit v1.3