vfs.cpp: Fix gcc6 crash.

Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Murai Takashi 2017-07-10 21:56:22 +09:00 committed by Jérôme Duval
parent 7e6a11ac5d
commit 5b55f6dba9
1 changed files with 8 additions and 3 deletions

View File

@ -7275,7 +7275,9 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags,
FileDeviceDeleter() : id(-1) {}
~FileDeviceDeleter()
{
KDiskDeviceManager::Default()->DeleteFileDevice(id);
KDiskDeviceManager* ddm = KDiskDeviceManager::Default();
if (ddm != NULL)
ddm->DeleteFileDevice(id);
}
partition_id id;
@ -7780,8 +7782,11 @@ fs_unmount(char* path, dev_t mountID, uint32 flags, bool kernel)
partition->SetVolumeID(-1);
partition->SetMountCookie(NULL);
if (mount->owns_file_device)
KDiskDeviceManager::Default()->DeleteFileDevice(partition->ID());
if (mount->owns_file_device) {
KDiskDeviceManager* ddm = KDiskDeviceManager::Default();
if (ddm != NULL)
ddm->DeleteFileDevice(partition->ID());
}
partition->Unregister();
}