diff --git a/src/trap.zig b/src/trap.zig index 1a63140..e88155f 100644 --- a/src/trap.zig +++ b/src/trap.zig @@ -79,8 +79,8 @@ pub const TrapCode = enum(u8) { pub const Trap = struct { /// Creates a new trap. /// The `Trap` returned is owned by the caller. - pub fn init(message: []const u8) Trap { - return wasmtime_trap_new(message.ptr, message.len); + pub fn init(message: [:0]const u8) Trap { + return wasmtime_trap_new(message.ptr, message.len + 1); } pub fn copy(self: *const Trap) Trap {