summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c3
1 files changed, 3 insertions, 0 deletions
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);