Fix segv when passing an unknown protocol
authorAnthony Liguori <aliguori@us.ibm.com>
Fri, 22 May 2009 13:17:55 +0000 (08:17 -0500)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 22 May 2009 15:50:29 +0000 (10:50 -0500)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

block.c

diff --git a/block.c b/block.c
index 980fbec..cbc83b1 100644 (file)
--- a/block.c
+++ b/block.c
@@ -306,7 +306,7 @@ static BlockDriver *find_image_format(const char *filename)
 
     drv = find_protocol(filename);
     /* no need to test disk image formats for vvfat */
-    if (strcmp(drv->format_name, "vvfat") == 0)
+    if (drv && strcmp(drv->format_name, "vvfat") == 0)
         return drv;
 
     ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY);