mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
do not allow malloc(0)
This commit is contained in:
@ -1126,6 +1126,9 @@ pub fn (s []string) join_lines() string {
|
||||
|
||||
// reverse will return a new reversed string.
|
||||
pub fn (s string) reverse() string {
|
||||
if s.len == 0 {
|
||||
return ''
|
||||
}
|
||||
mut res := string {
|
||||
len: s.len
|
||||
str: malloc(s.len)
|
||||
|
Reference in New Issue
Block a user