Merge pull request #3785 from wiktor-k/fix-notifications

Fix NPE when accessing settings screens
This commit is contained in:
cketti 2018-12-02 18:25:12 +01:00 committed by GitHub
commit 1552c151a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,10 +165,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
}
private fun initializeNotifications() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PRE_SDK26_NOTIFICATION_PREFERENCES.forEach { findPreference(it).remove() }
} else {
findPreference(PREFERENCE_OPEN_NOTIFICATION_SETTINGS).remove()
findPreference(PREFERENCE_OPEN_NOTIFICATION_SETTINGS)?.let {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PRE_SDK26_NOTIFICATION_PREFERENCES.forEach { findPreference(it).remove() }
} else {
it.remove()
}
}
}