VirtualBox

Changeset 23245 in vbox for trunk


Ignore:
Timestamp:
Sep 23, 2009 8:12:07 AM (15 years ago)
Author:
vboxsync
Message:

Main/MachineImpl: add a few missing null medium checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r23223 r23245  
    19771977    {
    19781978        Medium *pMedium = pAttachTemp->medium();
    1979         AutoReadLock mediumLock(pMedium);
    1980         return setError(VBOX_E_OBJECT_IN_USE,
    1981                         tr("Medium '%ls' is already attached to device slot %d on port %d of controller '%ls' of this virtual machine"),
    1982                         pMedium->locationFull().raw(), aDevice, aControllerPort, aControllerName);
     1979        if (pMedium)
     1980        {
     1981            AutoReadLock mediumLock(pMedium);
     1982            return setError(VBOX_E_OBJECT_IN_USE,
     1983                            tr("Medium '%ls' is already attached to device slot %d on port %d of controller '%ls' of this virtual machine"),
     1984                            pMedium->locationFull().raw(), aDevice, aControllerPort, aControllerName);
     1985        }
     1986        else
     1987            return setError(VBOX_E_OBJECT_IN_USE,
     1988                            tr("Device is already attached to slot %d on port %d of controller '%ls' of this virtual machine"),
     1989                            aDevice, aControllerPort, aControllerName);
    19831990    }
    19841991
     
    20712078    AutoWriteLock mediumLock(medium);
    20722079
    2073     if ((pAttachTemp = findAttachment(mMediaData->mAttachments,
    2074                                       medium)))
     2080    if (   (pAttachTemp = findAttachment(mMediaData->mAttachments, medium))
     2081        && !medium.isNull())
    20752082    {
    20762083        return setError(VBOX_E_OBJECT_IN_USE,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette