From 4bfabab005bac62373b80407136b75509b8b57db Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Mon, 29 Dec 2014 09:15:37 -0600 Subject: 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 --- partitionmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'partitionmanager.cpp') diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 003dcd1f3..be6674b88 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -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); -- cgit v1.2.3