summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-17 15:03:16 +0100
committerGitHub <noreply@github.com>2019-12-17 15:03:16 +0100
commitfbc176d7407ed1fb47a685a5e37cdf3d100d0afe (patch)
treea3f1ad7734ae103e03c50c6dc41c345093e8bce7
parent22637beb2ed625c3e43ab75ab5865b57d7470948 (diff)
parentca19a3fe9ae82a0ac40b8f2ce47af952d0d9cdf5 (diff)
Merge pull request #34401 from Faless/android/fix_get_manifest_permissions
Fix crash on Android with no manifest permissions.
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
index 7e35417c6a..e340135f69 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
@@ -101,7 +101,7 @@ public final class PermissionsUtil {
return false;
}
- if (manifestPermissions == null || manifestPermissions.length == 0)
+ if (manifestPermissions.length == 0)
return true;
List<String> dangerousPermissions = new ArrayList<>();
@@ -141,8 +141,8 @@ public final class PermissionsUtil {
e.printStackTrace();
return new String[0];
}
- if (manifestPermissions == null || manifestPermissions.length == 0)
- return new String[0];
+ if (manifestPermissions.length == 0)
+ return manifestPermissions;
List<String> dangerousPermissions = new ArrayList<>();
for (String manifestPermission : manifestPermissions) {
@@ -188,6 +188,8 @@ public final class PermissionsUtil {
private static String[] getManifestPermissions(Godot activity) throws PackageManager.NameNotFoundException {
PackageManager packageManager = activity.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(activity.getPackageName(), PackageManager.GET_PERMISSIONS);
+ if (packageInfo.requestedPermissions == null)
+ return new String[0];
return packageInfo.requestedPermissions;
}