fix: prevent panic on empty message receive
This commit is contained in:
parent
fbb5c8e200
commit
9a51d756ce
1 changed files with 2 additions and 1 deletions
|
@ -138,7 +138,8 @@ pub const message = struct {
|
|||
}
|
||||
|
||||
pub fn from(span: anytype) Self {
|
||||
return .{ .buf = span.base[0..span.len] };
|
||||
const buf = if (span.len > 0) span.base[0..span.len] else &[_]u8{};
|
||||
return .{ .buf = buf };
|
||||
}
|
||||
|
||||
pub fn to(self: *const Self, comptime T: type) T {
|
||||
|
|
Loading…
Add table
Reference in a new issue