1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: fix panic on os.is_abs_path('')

This commit is contained in:
Delyan Angelov 2021-05-09 10:45:34 +03:00
parent 26652c8a23
commit 38d16229ef
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -417,6 +417,9 @@ pub fn is_file(path string) bool {
// is_abs_path returns `true` if `path` is absolute. // is_abs_path returns `true` if `path` is absolute.
pub fn is_abs_path(path string) bool { pub fn is_abs_path(path string) bool {
if path.len == 0 {
return false
}
$if windows { $if windows {
return path[0] == `/` || // incase we're in MingGW bash return path[0] == `/` || // incase we're in MingGW bash
(path[0].is_letter() && path[1] == `:`) (path[0].is_letter() && path[1] == `:`)