| author | |
| committer | |
| log | fa955f0024bc1e63200f6c6e3d22cf88dc6a65a5 |
| tree | 40121670ba4c0ad573029ed678fda0415d0aaede |
| parent | 52471f6221c76f47b0661754511b3559e60fd801 |
| signature |
If fmt was called on with a [*]u8 or [*]const u8 argument, but the fmt string did not specify 's' to treat it as a string, it produced a compile error due to accessing index 1 of a 0 length slice.1 files changed, 1 insertions(+), 1 deletions(-)
std/fmt/index.zig+1-1| ... | ... | @@ -179,7 +179,7 @@ pub fn formatType( |
| 179 | 179 | }, |
| 180 | 180 | builtin.TypeInfo.Pointer.Size.Many => { |
| 181 | 181 | if (ptr_info.child == u8) { |
| 182 | if (fmt[0] == 's') { | |
| 182 | if (fmt.len > 0 and fmt[0] == 's') { | |
| 183 | 183 | const len = std.cstr.len(value); |
| 184 | 184 | return formatText(value[0..len], fmt, context, Errors, output); |
| 185 | 185 | } |