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
diff --git a/partition.cpp b/partition.cpp
index add9460..3fadfb9 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1509,6 +1509,11 @@
}
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;