diff --git a/tests/qemumigrationcookiexmltest.c b/tests/qemumigrationcookiexmltest.c index 74302dc55f..5270e3a7e7 100644 --- a/tests/qemumigrationcookiexmltest.c +++ b/tests/qemumigrationcookiexmltest.c @@ -137,9 +137,17 @@ static int testQemuMigrationCookieParse(const void *opaque) { struct testQemuMigrationCookieData *data = (struct testQemuMigrationCookieData *) opaque; - qemuDomainObjPrivate *priv = data->vm->privateData; + qemuDomainObjPrivate *priv; g_auto(virBuffer) actual = VIR_BUFFER_INITIALIZER; + /* if the VM object parsing step failed there's nothing this test can do */ + if (!data->vm) { + VIR_TEST_DEBUG("\nmissing VM object\n"); + return -1; + } + + priv = data->vm->privateData; + if (!(data->cookie = qemuMigrationCookieParse(&driver, data->vm, data->vm->def, @@ -314,6 +322,12 @@ testQemuMigrationCookieBlockDirtyBitmaps(const void *opaque) return -1; } + /* if the VM object parsing step failed there's nothing this test can do */ + if (!data->vm) { + VIR_TEST_DEBUG("\nmissing VM object\n"); + return -1; + } + if (qemuMigrationCookieBlockDirtyBitmapsMatchDisks(data->vm->def, data->cookie->blockDirtyBitmaps) < 0) return -1;