Skip to content

Commit 1a9d2f3

Browse files
isaachierandrewrk
authored andcommittedJun 8, 2018
Fix error handling in Buffer::fromOwnedSlice (#1082)
·
0.15.20.3.0
1 parent 39fa313 commit 1a9d2f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎std/buffer.zig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ pub const Buffer = struct {
4141
/// Buffer takes ownership of the passed in slice. The slice must have been
4242
/// allocated with `allocator`.
4343
/// Must deinitialize with deinit.
44-
pub fn fromOwnedSlice(allocator: *Allocator, slice: []u8) Buffer {
44+
pub fn fromOwnedSlice(allocator: *Allocator, slice: []u8) !Buffer {
4545
var self = Buffer{ .list = ArrayList(u8).fromOwnedSlice(allocator, slice) };
46-
self.list.append(0);
46+
try self.list.append(0);
4747
return self;
4848
}
4949

0 commit comments

Comments
 (0)
Please sign in to comment.