From 6ba2ba4ac63bec7bd4bff40094d0779a75349cbb Mon Sep 17 00:00:00 2001 From: Grantland Chew Date: Thu, 10 Dec 2015 11:32:16 -0800 Subject: [PATCH] Allow the system to error when missing required permissions Our GCM permission checks would NPE if there were no permissions defined. Adding a proper null check allows the system to properly throw when missing required ACCESS_NETWORK_STATE or INTERNET permissions --- Parse/src/main/java/com/parse/ManifestInfo.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Parse/src/main/java/com/parse/ManifestInfo.java b/Parse/src/main/java/com/parse/ManifestInfo.java index efedf8e98..96451570e 100644 --- a/Parse/src/main/java/com/parse/ManifestInfo.java +++ b/Parse/src/main/java/com/parse/ManifestInfo.java @@ -388,6 +388,9 @@ private static boolean hasRequestedPermissions(Context context, String... permis try { PackageInfo pi = context.getPackageManager().getPackageInfo( packageName, PackageManager.GET_PERMISSIONS); + if (pi.requestedPermissions == null) { + return false; + } return Arrays.asList(pi.requestedPermissions).containsAll(Arrays.asList(permissions)); } catch (NameNotFoundException e) { PLog.e(TAG, "Couldn't find info about own package", e);