Handle non-exist permission group correctly for pm list permissions

Test: adb shell pm list permissions non-exist-permission-group

Change-Id: I4e1a36ec673c9b3cc813346f6fce79f5017a099a
Signed-off-by: utzcoz <utzcoz@gmail.com>
This commit is contained in:
utzcoz
2021-06-12 19:24:43 +08:00
parent ebcfe1c6e0
commit 0303f0b1bc

View File

@@ -3516,7 +3516,7 @@ class PackageManagerShellCommand extends ShellCommand {
}
List<PermissionInfo> ps = mPermissionManager
.queryPermissionsByGroup(groupList.get(i), 0 /*flags*/);
final int count = ps.size();
final int count = (ps == null ? 0 : ps.size());
boolean first = true;
for (int p = 0 ; p < count ; p++) {
PermissionInfo pi = ps.get(p);