summaryrefslogtreecommitdiffstats
path: root/media/mtp
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2016-06-02 10:35:32 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-06-07 14:16:51 -0700
commit9bdc0f69492d90fbceca68d3b40716b4722a3222 (patch)
treebf6c01f85a37e459b1727ebbad2ac270ad713d10 /media/mtp
parent80c362fec14af5f22e6d3967fc4ea04b363084da (diff)
downloadframeworks_av-9bdc0f69492d90fbceca68d3b40716b4722a3222.zip
frameworks_av-9bdc0f69492d90fbceca68d3b40716b4722a3222.tar.gz
frameworks_av-9bdc0f69492d90fbceca68d3b40716b4722a3222.tar.bz2
MTP: Fix crash when no storages are available
Change-Id: I6d7202ade46a5d781a3db5a1a3bdde17c8e70a60
Diffstat (limited to 'media/mtp')
-rw-r--r--media/mtp/MtpServer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 3c91ffd..96ce81b 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -138,7 +138,7 @@ void MtpServer::removeStorage(MtpStorage* storage) {
MtpStorage* MtpServer::getStorage(MtpStorageID id) {
if (id == 0)
- return mStorages[0];
+ return mStorages.empty() ? NULL : mStorages[0];
for (size_t i = 0; i < mStorages.size(); i++) {
MtpStorage* storage = mStorages[i];
if (storage->getStorageID() == id)