Skip to content

Commit 6ba2ba4

Browse files
committed
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
1 parent 04ed975 commit 6ba2ba4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Parse/src/main/java/com/parse/ManifestInfo.java

+3
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ private static boolean hasRequestedPermissions(Context context, String... permis
388388
try {
389389
PackageInfo pi = context.getPackageManager().getPackageInfo(
390390
packageName, PackageManager.GET_PERMISSIONS);
391+
if (pi.requestedPermissions == null) {
392+
return false;
393+
}
391394
return Arrays.asList(pi.requestedPermissions).containsAll(Arrays.asList(permissions));
392395
} catch (NameNotFoundException e) {
393396
PLog.e(TAG, "Couldn't find info about own package", e);

0 commit comments

Comments
 (0)