summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--strio.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/strio.h b/strio.h
index ab4d2bc..2376514 100644
--- a/strio.h
+++ b/strio.h
@@ -176,9 +176,10 @@ void str_cat_fmtv(Str *out, Arena *arena, const char *fmt, va_list ap) {
case 's':
str_cat(out, str_from_cstr(va_arg(ap, const char *)), arena);
break;
- case 'S':
- str_cat(out, va_arg(ap, Str), arena);
- break;
+ case 'S': {
+ Str s = va_arg(ap, Str);
+ if (s.n > 0) str_cat(out, s, arena);
+ } break;
case 'i':
str_cat_i64(out, va_arg(ap, int32_t), zero_pad?'0':' ', min_width, arena);
break;