Merge "make shutdown safe for double calls." am: 71fa1068de am: 2f93c657f4
am: 2a8605b9d1

Change-Id: Id1cd83d307e7791359bc6dfd96368f1138ff21d2
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 9dc250b..40e3921 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -639,8 +639,13 @@
     return 0;
 }
 
+// Can be called twice (sequentially) during shutdown. should be safe for that.
 int VolumeManager::shutdown() {
+    if (mInternalEmulated == nullptr) {
+        return 0; // already shutdown
+    }
     mInternalEmulated->destroy();
+    mInternalEmulated = nullptr;
     for (const auto& disk : mDisks) {
         disk->destroy();
     }