aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-10 17:41:58 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-10 17:41:58 +0100
commitb08f674dcce45d4778287263f3a33e4aa2b6330a (patch)
tree1f951b051b16c44810f8eb77ca43c3e26ff879b3 /src/main/java/de/pixart
parent474804b16b3e2a2283df69813304c3e56996b87c (diff)
add null checks to huawei settings code
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index b519cf5e4..0ee32de09 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -92,11 +92,13 @@ public class SettingsActivity extends XmppActivity implements
//this feature is only available on Huawei Android 6.
PreferenceScreen huaweiPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("huawei");
- Intent intent = huaweiPreferenceScreen.getIntent();
- //remove when Api version is above M (Version 6.0) or if the intent is not callable
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M || !isCallable(intent)) {
- PreferenceCategory generalCategory = (PreferenceCategory) mSettingsFragment.findPreference("general");
- generalCategory.removePreference(huaweiPreferenceScreen);
+ if (huaweiPreferenceScreen != null) {
+ Intent intent = huaweiPreferenceScreen.getIntent();
+ //remove when Api version is above M (Version 6.0) or if the intent is not callable
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M || !isCallable(intent)) {
+ PreferenceCategory generalCategory = (PreferenceCategory) mSettingsFragment.findPreference("general");
+ generalCategory.removePreference(huaweiPreferenceScreen);
+ }
}
@@ -191,8 +193,8 @@ public class SettingsActivity extends XmppActivity implements
});
}
- private boolean isCallable(Intent intent) {
- return getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
+ private boolean isCallable(final Intent i) {
+ return i != null && getPackageManager().queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
}
private void deleteOmemoIdentities() {
@@ -341,10 +343,4 @@ public class SettingsActivity extends XmppActivity implements
public void refreshUiReal() {
//nothing to do. This Activity doesn't implement any listeners
}
-
- @Override
- public void onPause() {
- super.onPause();
- finish();
- }
}