Skip to content

Commit

Permalink
Fixed possible crash when restoring defaults of the BehaviorPreferenc…
Browse files Browse the repository at this point in the history
…eFragment.
  • Loading branch information
michael-rapp committed Feb 16, 2017
1 parent e364cfa commit 467ca98
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ private OnPreferenceChangeListener createOverrideBackButtonChangeListener() {

@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
boolean overrideNavigationIcon = (boolean) newValue;
((PreferenceActivity) getActivity()).overrideNavigationIcon(overrideNavigationIcon);
if (newValue != null) {
boolean overrideNavigationIcon = (boolean) newValue;
((PreferenceActivity) getActivity())
.overrideNavigationIcon(overrideNavigationIcon);
}

return true;
}

Expand All @@ -66,8 +70,11 @@ private OnPreferenceChangeListener createHideNavigationChangeListener() {

@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
boolean hideNavigation = (boolean) newValue;
((PreferenceActivity) getActivity()).hideNavigation(hideNavigation);
if (newValue != null) {
boolean hideNavigation = (boolean) newValue;
((PreferenceActivity) getActivity()).hideNavigation(hideNavigation);
}

return true;
}

Expand Down

0 comments on commit 467ca98

Please sign in to comment.