From 25f20c19286c68c7071a5f2508a514d30bb5b8fb Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Tue, 14 Oct 2014 09:04:43 -0500 Subject: 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 --- partition.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/partition.cpp b/partition.cpp index add9460fc..3fadfb980 100644 --- a/partition.cpp +++ b/partition.cpp @@ -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; -- cgit v1.2.3