Skip to content

Commit

Permalink
check nil here because it can be nil in test
Browse files Browse the repository at this point in the history
  • Loading branch information
kahing committed Jan 5, 2020
1 parent 4e18c3e commit 12a3b12
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,17 @@ func NewDirHandle(inode *Inode) (dh *DirHandle) {

func (inode *Inode) OpenDir() (dh *DirHandle) {
inode.logFuse("OpenDir")
var isS3 bool

parent := inode.Parent
cloud, _ := inode.cloud()
_, isS3 := cloud.Delegate().(*S3Backend)

// in test we sometimes set cloud to nil to ensure we are not
// talking to the cloud
if cloud != nil {
_, isS3 = cloud.Delegate().(*S3Backend)
}

dir := inode.dir
if dir == nil {
panic(fmt.Sprintf("%v is not a directory", inode.FullName()))
Expand Down

0 comments on commit 12a3b12

Please sign in to comment.