VBOX: Fix crash if DVD-ROM media had been ejected by some external event. Technically this shouldn't be happening, but something funky is going on with VirtualBox and we need to handle things that may cause a crash when cleaning up the VM.

This commit is contained in:
Rom Walton 2014-12-08 11:56:33 -05:00
parent f1b8c697be
commit f2a7c28fc0
1 changed files with 5 additions and 1 deletions

View File

@ -1144,7 +1144,11 @@ int VBOX_VM::deregister_vm(bool delete_media) {
pMediumAttachment->get_Port(&lPort);
pMediumAttachment->get_Medium(&pMedium);
mediums.push_back(CComPtr<IMedium>(pMedium));
// If the device in question is a DVD/CD-ROM drive, the medium may have been ejected.
// If so, pMedium will be NULL.
if (pMedium) {
mediums.push_back(CComPtr<IMedium>(pMedium));
}
rc = pMachine->DetachDevice(strController, lPort, lDevice);
CHECK_ERROR(rc);