From 15b1feea9d8af5b39bcc76014b45ae6d67f2efc9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 6 Oct 2019 12:06:26 +0100 Subject: [PATCH] mount: fix panic on File.Open - Fixes #3595 This problem was introduced in "mount: allow files of unkown size to be read properly" 0baafb158f6dc5ab by failure to check that the DirEntry was nil or not. --- cmd/mount/file.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/mount/file.go b/cmd/mount/file.go index 4bc7c3d45..2a13feb63 100644 --- a/cmd/mount/file.go +++ b/cmd/mount/file.go @@ -74,7 +74,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR } // If size unknown then use direct io to read - if handle.Node().DirEntry().Size() < 0 { + if entry := handle.Node().DirEntry(); entry != nil && entry.Size() < 0 { resp.Flags |= fuse.OpenDirectIO }