diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 29ab099e3e0818a9d9c85f0449c8df2e4b9b5f70..10f137381ac7ec84ca13ea3332373f091cc58f81 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -357,7 +357,7 @@ int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len,
 		 */
 		parent = p->d_inode;
 	}
-	if (nop->encode_fh)
+	if (nop && nop->encode_fh)
 		error = nop->encode_fh(inode, fid->raw, max_len, parent);
 	else
 		error = export_encode_fh(inode, fid, max_len, parent);