| ... | ... | @@ -176,7 +176,9 @@ pub fn print( |
| 176 | 176 | |
| 177 | 177 | var i: u32 = 0; |
| 178 | 178 | while (i < max_len) : (i += 1) { |
| 179 | | buf[i] = std.math.cast(u8, val.fieldValue(ty, i).toUnsignedInt(target)) orelse break :str; |
| 179 | const elem = val.fieldValue(ty, i); |
| 180 | if (elem.isUndef()) break :str; |
| 181 | buf[i] = std.math.cast(u8, elem.toUnsignedInt(target)) orelse break :str; |
| 180 | 182 | } |
| 181 | 183 | |
| 182 | 184 | const truncated = if (len > max_string_len) " (truncated)" else ""; |
| ... | ... | @@ -390,6 +392,7 @@ pub fn print( |
| 390 | 392 | while (i < max_len) : (i += 1) { |
| 391 | 393 | var elem_buf: Value.ElemValueBuffer = undefined; |
| 392 | 394 | const elem_val = payload.ptr.elemValueBuffer(mod, i, &elem_buf); |
| 395 | if (elem_val.isUndef()) break :str; |
| 393 | 396 | buf[i] = std.math.cast(u8, elem_val.toUnsignedInt(target)) orelse break :str; |
| 394 | 397 | } |
| 395 | 398 | |