diff --git a/internal/dir.go b/internal/dir.go
index <HASH>..<HASH> 100644
--- a/internal/dir.go
+++ b/internal/dir.go
@@ -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()))
check nil here because it can be nil in test