[core] Get rid of NPE

This commit is contained in:
LoveSy 2021-02-19 23:15:48 +08:00 committed by tehcneko
parent 6e115426e4
commit db18cfcb60
1 changed files with 2 additions and 0 deletions

View File

@ -70,10 +70,12 @@ public class PackageService {
public static Set<String> fetchProcesses(PackageInfo pkgInfo) {
HashSet<String> processNames = new HashSet<>();
for (ComponentInfo[] componentInfos : new ComponentInfo[][]{pkgInfo.activities, pkgInfo.receivers, pkgInfo.providers}) {
if (componentInfos == null) continue;
for (ComponentInfo componentInfo : componentInfos) {
processNames.add(componentInfo.processName);
}
}
if (pkgInfo.services == null) return processNames;
for (ServiceInfo service : pkgInfo.services) {
if ((service.flags & FLAG_ISOLATED_PROCESS) == 0) {
processNames.add(service.processName);