summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alexandra Gherghina <alexgherghina@google.com> 2014-04-24 17:55:30 +0100
committer Alexandra Gherghina <alexgherghina@google.com> 2014-04-24 17:55:30 +0100
commita4fcb4403304192e2a4889c43c4d089d76cd1252 (patch)
tree8f75480a467ea0975e4794890f7186c0ee2a7d1c
parente255d7399f46de4b4e3d94b95b26df3408274394 (diff)
Fix two potential NPEs in DeviceInfo
Change-Id: Ic4b5b203af25cda9ae65b477c92c1fb5f31ab093
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java4
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java2
2 files changed, 3 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
index 31865279e60b..629dea2263aa 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DeviceOwner.java
@@ -110,11 +110,11 @@ public class DeviceOwner {
}
String getDeviceOwnerPackageName() {
- return mDeviceOwner.packageName;
+ return mDeviceOwner != null ? mDeviceOwner.packageName : null;
}
String getDeviceOwnerName() {
- return mDeviceOwner.name;
+ return mDeviceOwner != null ? mDeviceOwner.name : null;
}
void setDeviceOwner(String packageName, String ownerName) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index cf4514919be6..b82a1269d3a0 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2828,7 +2828,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
return null;
}
synchronized (this) {
- if (mDeviceOwner != null) {
+ if (mDeviceOwner != null && mDeviceOwner.hasDeviceOwner()) {
return mDeviceOwner.getDeviceOwnerPackageName();
}
}