Check mMediaProvider for null

Getting the content provider could
return null in some cases where the user
is locked, so check for that when closing.

Bug: 73656609
Test: no crash
Change-Id: I607cd2da5348520616a1c171d0d8a1afacabe592
This commit is contained in:
Jerry Zhang
2018-03-02 15:40:03 -08:00
parent 74cfe56742
commit 484ea675dd

View File

@@ -292,7 +292,9 @@ public class MtpDatabase implements AutoCloseable {
mCloseGuard.close();
if (mClosed.compareAndSet(false, true)) {
mMediaScanner.close();
mMediaProvider.close();
if (mMediaProvider != null) {
mMediaProvider.close();
}
native_finalize();
}
}