iclouddrive: fix potential crash looking up items

findItem read the response status code when the lookup failed, so a
failure with no HTTP response panicked.

Thanks to @manus-pi for finding this problem.
This commit is contained in:
Nick Craig-Wood committed 2026-09-22 11:03:16 +01:00
1 parent 35abcadfc7
commit 1e92520076
1 file changed
+1 -1
+1 -1
View File
@@ -92,7 +92,7 @@ func (f *Fs) findItem(ctx context.Context, dir string) (item *api.DriveItem, fou
item, resp, err = f.service.GetItemByPath(ctx, path.Join(f.root, dir))
return shouldRetry(ctx, resp, err)
}); err != nil {
if item == nil && resp.StatusCode == 404 {
if item == nil && resp != nil && resp.StatusCode == 404 {
return nil, false, nil
}
return nil, false, err