Don't try to free empty strings

This commit is contained in:
Richard Feldman 2020-12-04 00:17:46 -05:00
parent ef258fe675
commit 505ade3282

View file

@ -77,7 +77,7 @@ const RocStr = extern struct {
}
pub fn deinit(self: RocStr, allocator: *Allocator) void {
if (!self.isSmallStr()) {
if (!self.isSmallStr() and !self.isEmpty()) {
const strBytesPtr: [*]u8 = self.bytesPtr orelse unreachable;
const strBytes: []u8 = strBytesPtr[0..self.bytesCount];