Skip to content

Commit

Permalink
Fix error handling in Buffer::fromOwnedSlice (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaachier authored and andrewrk committed Jun 8, 2018
1 parent 39fa313 commit 1a9d2f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions std/buffer.zig
Expand Up @@ -41,9 +41,9 @@ pub const Buffer = struct {
/// Buffer takes ownership of the passed in slice. The slice must have been
/// allocated with `allocator`.
/// Must deinitialize with deinit.
pub fn fromOwnedSlice(allocator: *Allocator, slice: []u8) Buffer {
pub fn fromOwnedSlice(allocator: *Allocator, slice: []u8) !Buffer {
var self = Buffer{ .list = ArrayList(u8).fromOwnedSlice(allocator, slice) };
self.list.append(0);
try self.list.append(0);
return self;
}

Expand Down

0 comments on commit 1a9d2f3

Please sign in to comment.