diff options
author | Tom Marshall <tdm@cyngn.com> | 2016-06-02 10:35:32 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-06-07 14:16:51 -0700 |
commit | 9bdc0f69492d90fbceca68d3b40716b4722a3222 (patch) | |
tree | bf6c01f85a37e459b1727ebbad2ac270ad713d10 /media/mtp | |
parent | 80c362fec14af5f22e6d3967fc4ea04b363084da (diff) | |
download | frameworks_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.cpp | 2 |
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) |