diff --git a/block.c b/block.c index 6b29285381..d7cb7d48fa 100644 --- a/block.c +++ b/block.c @@ -5381,6 +5381,9 @@ void bdrv_ref(BlockDriverState *bs) * deleted. */ void bdrv_unref(BlockDriverState *bs) { + if (!bs) { + return; + } assert(bs->refcnt > 0); if (--bs->refcnt == 0) { bdrv_delete(bs);