string: do not free empty strings

pull/5364/head
Alexander Medvednikov 2020-06-12 17:20:51 +00:00
parent ca63b92d4f
commit af27963938
1 changed files with 3 additions and 1 deletions

View File

@ -1183,7 +1183,9 @@ pub fn (c byte) is_letter() bool {
}
pub fn (s &string) free() {
if s.is_lit {return}
if s.is_lit || s.len == 0 {
return
}
free(s.str)
}