commit 4c95b2f9d1c6fd020c484fef53f796448203fb12 (tree)
parent 52471f6221c76f47b0661754511b3559e60fd801
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Tue, 14 Aug 2018 14:38:20 -0400
Merge pull request #1379 from tgschultz/patch-1
fixed handling of [*]u8 when no format specifier is set
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/std/fmt/index.zig b/std/fmt/index.zig
@@ -179,7 +179,7 @@ pub fn formatType(
},
builtin.TypeInfo.Pointer.Size.Many => {
if (ptr_info.child == u8) {
- if (fmt[0] == 's') {
+ if (fmt.len > 0 and fmt[0] == 's') {
const len = std.cstr.len(value);
return formatText(value[0..len], fmt, context, Errors, output);
}