mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
builtin: fix undefined read s[0], from ''.is_lower() and ''.is_upper() in c7af2c2
This commit is contained in:
parent
c7af2c21d1
commit
d66de0c514
1 changed files with 2 additions and 2 deletions
|
@ -1524,7 +1524,7 @@ pub fn (s string) to_lower() string {
|
|||
// Example: assert 'hello developer'.is_lower() == true
|
||||
@[direct_array_access]
|
||||
pub fn (s string) is_lower() bool {
|
||||
if s[0].is_digit() {
|
||||
if s.len > 0 && s[0].is_digit() {
|
||||
return false
|
||||
}
|
||||
for i in 0 .. s.len {
|
||||
|
@ -1558,7 +1558,7 @@ pub fn (s string) to_upper() string {
|
|||
// Example: assert 'HELLO V'.is_upper() == true
|
||||
@[direct_array_access]
|
||||
pub fn (s string) is_upper() bool {
|
||||
if s[0].is_digit() {
|
||||
if s.len > 0 && s[0].is_digit() {
|
||||
return false
|
||||
}
|
||||
for i in 0 .. s.len {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue