summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-20 07:32:01 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-20 07:32:01 +0000
commitf074989f62310a1f3d47fc6e6632314ce6865ca5 (patch)
treea807a8fa23589d38adedff6d54542fb0762af54a
parent79451b496bf6fef8b5e40dfcf672eb37a5c3eb1d (diff)
parent7056de1b423e10b16149df3db0102aff714f2648 (diff)
downloadandroid_system_vold-f074989f62310a1f3d47fc6e6632314ce6865ca5.tar.gz
android_system_vold-f074989f62310a1f3d47fc6e6632314ce6865ca5.tar.bz2
android_system_vold-f074989f62310a1f3d47fc6e6632314ce6865ca5.zip
release-request-369362fc-cc6c-4cb1-95c0-90b5ac7c52cb-for-git_oc-mr1-release-4288633 snap-temp-L81700000095141745
Change-Id: I2b66a50873ab1232d02a72093f8ee3246f6d7dac
-rw-r--r--VolumeManager.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 8398498..13a943f 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -425,7 +425,10 @@ std::shared_ptr<android::vold::Disk> VolumeManager::findDisk(const std::string&
}
std::shared_ptr<android::vold::VolumeBase> VolumeManager::findVolume(const std::string& id) {
- if (mInternalEmulated->getId() == id) {
+ // Vold could receive "mount" after "shutdown" command in the extreme case.
+ // If this happens, mInternalEmulated will equal nullptr and
+ // we need to deal with it in order to avoid null pointer crash.
+ if (mInternalEmulated != nullptr && mInternalEmulated->getId() == id) {
return mInternalEmulated;
}
for (const auto& disk : mDisks) {
@@ -689,8 +692,10 @@ next:
int VolumeManager::reset() {
// Tear down all existing disks/volumes and start from a blank slate so
// newly connected framework hears all events.
- mInternalEmulated->destroy();
- mInternalEmulated->create();
+ if (mInternalEmulated != nullptr) {
+ mInternalEmulated->destroy();
+ mInternalEmulated->create();
+ }
for (const auto& disk : mDisks) {
disk->destroy();
disk->create();