From 243826bd67e4291e2409d948e41f5efdd92b2c62 Mon Sep 17 00:00:00 2001 From: Vyacheslav Chigrin Date: Thu, 4 Jul 2024 03:25:39 +0000 Subject: [PATCH] Fix crash in filesystem API (#69) This help me fix #issues/64 Reviewed-on: https://gitea.elara.ws/Elara6331/itd/pulls/69 Reviewed-by: Elara Fixes #64 Co-authored-by: Vyacheslav Chigrin Co-committed-by: Vyacheslav Chigrin --- api/fs.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/fs.go b/api/fs.go index 6d5d178..0a63f4a 100644 --- a/api/fs.go +++ b/api/fs.go @@ -42,7 +42,10 @@ func (c *FSClient) Mkdir(ctx context.Context, paths ...string) error { func (c *FSClient) ReadDir(ctx context.Context, dir string) ([]FileInfo, error) { res, err := c.client.ReadDir(ctx, &rpc.PathRequest{Path: dir}) - return convertEntries(res.Entries), err + if err != nil { + return nil, err + } + return convertEntries(res.Entries), nil } func convertEntries(e []*rpc.FileInfo) []FileInfo {