summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAli Utku Selen <aliutku.selen@sonyericsson.com>2010-11-30 10:37:10 +0100
committerSteve Kondik <shade@chemlab.org>2011-01-21 00:12:57 -0500
commit0a4f04e814ec910a7e8348a139940ca81f4940ac (patch)
tree9e38213812c66157fa36957bbf99322e81b4bf86 /cmds
parent881ff3d168315d1ae8d3c397f368b03fb1d22e2a (diff)
downloadframeworks_base-0a4f04e814ec910a7e8348a139940ca81f4940ac.zip
frameworks_base-0a4f04e814ec910a7e8348a139940ca81f4940ac.tar.gz
frameworks_base-0a4f04e814ec910a7e8348a139940ca81f4940ac.tar.bz2
Fix crash by "adb shell pm list permissions -f|-s"
pm command makes the assumption that every permission should contain android:description and android:label attributes while they are not mandatory. If a permission does not contain these two attributes, we get "android.content.res. Resources$NotFoundException: String resource ID #0x0" followed by a NPE when using -f or -s options. With the following change, users will get "null" in output for respective fields. Change-Id: I4e7f407592fa071abdab1d979775f46ec27dc9d2
Diffstat (limited to 'cmds')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index 9b8b0ac..46fa114 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -341,9 +341,11 @@ public final class Pm {
if (nonLocalized != null) {
return nonLocalized.toString();
}
- Resources r = getResources(pii);
- if (r != null) {
- return r.getString(res);
+ if (res != 0) {
+ Resources r = getResources(pii);
+ if (r != null) {
+ return r.getString(res);
+ }
}
return null;
}