Merge "Check mMediaProvider for null" into pi-dev
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index a647dcc..32a00d5 100755
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -292,7 +292,9 @@
         mCloseGuard.close();
         if (mClosed.compareAndSet(false, true)) {
             mMediaScanner.close();
-            mMediaProvider.close();
+            if (mMediaProvider != null) {
+                mMediaProvider.close();
+            }
             native_finalize();
         }
     }