From 0d446c18dc84f8db522823f24983b8e71a0b0f04 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Fri, 28 Aug 2015 10:55:14 -0700 Subject: [PATCH] Crashing the system process is inadvisable When asking for the set of services published by a package, it's quite possible that there are none, in which case the returned List<> is null rather than valid-but-empty. Don't bother looking at it when it's null. Bug 23614440 Change-Id: Ibebb26b9c3f75ec810a95f1b9d2663e884cb98bc --- .../java/com/android/server/backup/BackupManagerService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 7c74a300e56c..12003e2e673b 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -1955,10 +1955,12 @@ public class BackupManagerService { .setPackage(pkgInfo.packageName); List hosts = mPackageManager.queryIntentServicesAsUser( intent, 0, UserHandle.USER_OWNER); - final int N = hosts.size(); - for (int i = 0; i < N; i++) { - final ServiceInfo info = hosts.get(i).serviceInfo; - tryBindTransport(info); + if (hosts != null) { + final int N = hosts.size(); + for (int i = 0; i < N; i++) { + final ServiceInfo info = hosts.get(i).serviceInfo; + tryBindTransport(info); + } } } -- 2.11.0