Check for valid MTP_Storage_ID before adding or removing
Attempting to add a storage ID of 0 was causing a seg fault.
Change-Id: If8797186405be36ee70dbca63bd1063a62ba2812
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 003dcd1..be6674b 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -2015,6 +2015,8 @@
}
if (Part) {
+ if (Part->MTP_Storage_ID == 0)
+ return false;
if (message_type == MTP_MESSAGE_REMOVE_STORAGE) {
mtp_message.message_type = MTP_MESSAGE_REMOVE_STORAGE; // Remove
LOGINFO("sending message to remove %i\n", Part->MTP_Storage_ID);