Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28433dbd authored by Svetoslav's avatar Svetoslav
Browse files

Fix a NPE in device policy manager service.

It is possible that the device does not have an owner. If there
is no owner we get a NPE when asking the device policy manager
for cross-profile widget providers.

bug:17989189

Change-Id: I5759f2dec160ed8076ab47fdf09134f78c57458d
parent a89ac60e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5320,6 +5320,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        @Override
        public List<String> getCrossProfileWidgetProviders(int profileId) {
            synchronized (DevicePolicyManagerService.this) {
                if (mDeviceOwner == null) {
                    return Collections.emptyList();
                }
                ComponentName ownerComponent = mDeviceOwner.getProfileOwnerComponent(profileId);
                if (ownerComponent == null) {
                    return Collections.emptyList();