Fix NullPointerException.

Fix a NullPointerException that can occur if a package with a recently
created rollback is no longer installed on device when the device boots.

Bug: 137135842
Test: atest CtsRollbackManagerHostTestCases
Change-Id: Ic007e44264647793c6271c3923c13c9e1736a9de
This commit is contained in:
Richard Uhler
2019-07-10 15:00:09 +01:00
parent 71682ae9c7
commit 17bfed91cc

View File

@@ -1289,7 +1289,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
private boolean packageVersionsEqual(VersionedPackage a, VersionedPackage b) {
return a.getPackageName().equals(b.getPackageName())
return a != null && b != null
&& a.getPackageName().equals(b.getPackageName())
&& a.getLongVersionCode() == b.getLongVersionCode();
}