Check if we can actually access the device via libparted and don't just segfault if that fails.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1084199
This commit is contained in:
Volker Lanz 2010-02-02 17:39:58 +00:00
parent 6438c7172d
commit 9f2ff10e2f
1 changed files with 6 additions and 0 deletions

View File

@ -319,6 +319,12 @@ void LibParted::scanDevices(OperationStack& ostack)
const Solid::Block* solidBlock = solidDevice.as<Solid::Block>();
PedDevice* pedDevice = ped_device_get(solidBlock->device().toLocal8Bit());
if (pedDevice == NULL)
{
Log(Log::warning) << i18nc("@info/plain", "Could not access device <filename>%1</filename>", solidBlock->device());
continue;
}
Log(Log::information) << i18nc("@info/plain", "Device found: %1", pedDevice->model);
Device* d = new Device(pedDevice->model, pedDevice->path, pedDevice->bios_geom.heads, pedDevice->bios_geom.sectors, pedDevice->bios_geom.cylinders, pedDevice->sector_size, solidDevice.icon());