TetherSettings: check provisionApp array length
Before attempting to get values from the provisionApp array, check to make sure there are at least two elements. BUG: 30889755 Change-Id: I42d6f8754910c12acf7bb3fbcc12e3f7be30d5e9 TEST: manually tried to open settings and it did not crash
This commit is contained in:
@@ -509,6 +509,9 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
private static boolean isIntentAvailable(Context context) {
|
private static boolean isIntentAvailable(Context context) {
|
||||||
String[] provisionApp = context.getResources().getStringArray(
|
String[] provisionApp = context.getResources().getStringArray(
|
||||||
com.android.internal.R.array.config_mobile_hotspot_provision_app);
|
com.android.internal.R.array.config_mobile_hotspot_provision_app);
|
||||||
|
if (provisionApp.length < 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final PackageManager packageManager = context.getPackageManager();
|
final PackageManager packageManager = context.getPackageManager();
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
intent.setClassName(provisionApp[0], provisionApp[1]);
|
intent.setClassName(provisionApp[0], provisionApp[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user