Fix wiping crash when block device is not present

Especially with /sd-ext, trying to wipe when the device is not
present causes a seg fault in the make_ext4fs function. Check to
make sure that the block device is present before trying to wipe.

Change-Id: I91973b5b832c9edbce81d61a271e84363c19e6c5
This commit is contained in:
Ethan Yonker
2014-10-14 09:04:43 -05:00
parent 5823d48f9e
commit 25f20c1928

View File

@@ -1509,6 +1509,11 @@ bool TWPartition::Wipe_EXT23(string File_System) {
}
bool TWPartition::Wipe_EXT4() {
Find_Actual_Block_Device();
if (!Is_Present) {
LOGERR("Block device not present, cannot wipe %s.\n", Display_Name.c_str());
return false;
}
if (!UnMount(true))
return false;