Merge "Fix NPE" into tm-dev

This commit is contained in:
Chun-Wei Wang 2022-04-01 10:32:47 +00:00 committed by Android (Google) Code Review
commit 8b12d853d8

View File

@ -410,7 +410,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
// Their staging dirs will be removed too
PackageInstallerSession root = !session.hasParentSessionId()
? session : mSessions.get(session.getParentSessionId());
if (!root.isDestroyed()) {
if (root == null) {
Slog.e(TAG, "freeStageDirs: found an orphaned session: "
+ session.sessionId + " parent=" + session.getParentSessionId());
} else if (!root.isDestroyed()) {
root.abandon();
}
} else {