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

os: turn some panics into return error()

This commit is contained in:
Delyan Angelov
2021-09-18 10:45:04 +03:00
parent 209b159554
commit eec930b86a
2 changed files with 3 additions and 2 deletions

View File

@@ -370,7 +370,7 @@ pub fn (f &File) read_bytes_at(size int, pos u64) []byte {
// A read call is either stopped, if the buffer is full, a newline was read or EOF.
pub fn (f &File) read_bytes_into_newline(mut buf []byte) ?int {
if buf.len == 0 {
panic(@FN + ': `buf.len` == 0')
return error(@FN + ': `buf.len` == 0')
}
newline := 10
mut c := 0
@@ -409,7 +409,7 @@ pub fn (f &File) read_bytes_into_newline(mut buf []byte) ?int {
// Returns the number of read bytes, or an error.
pub fn (f &File) read_bytes_into(pos u64, mut buf []byte) ?int {
if buf.len == 0 {
panic(@FN + ': `buf.len` == 0')
return error(@FN + ': `buf.len` == 0')
}
$if x64 {
$if windows {