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
This commit is contained in:
Ethan Yonker
2014-12-29 09:15:37 -06:00
committed by Dees Troy
parent f9f99bcb62
commit 4bfabab005
2 changed files with 11 additions and 5 deletions
+2
View File
@@ -2015,6 +2015,8 @@ bool TWPartitionManager::Add_Remove_MTP_Storage(TWPartition* Part, int message_t
}
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);