Fix potential crashes with themes

This commit is contained in:
tom79 2019-11-19 17:59:59 +01:00
parent fbb332da44
commit c61d656489
1 changed files with 4 additions and 0 deletions

View File

@ -246,6 +246,10 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements S
PreferenceScreen preferenceScreen = getPreferenceScreen();
FragmentActivity context = getActivity();
assert context != null;
if( preferenceScreen == null){
Toasty.error(getActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return;
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
ListPreference pref_theme_picker = (ListPreference) findPreference("pref_theme_picker");
Preference theme_link_color = findPreference("theme_link_color");