diff options
author | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-30 13:28:39 +0100 |
---|---|---|
committer | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-30 16:52:44 +0100 |
commit | df90cb00ebb12193e10e6817b3633857aaca9d0e (patch) | |
tree | de1ac099cbc2764ee9a2c2a8828c1f78e5a76931 /app/src/main | |
parent | e70a9001dc08c02a51ddda7251387840c2f3ed46 (diff) | |
download | AntennaPod-df90cb00ebb12193e10e6817b3633857aaca9d0e.zip |
Fix NPE when selecting Go to page for the first time
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 587b533a2..7e724c74b 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -232,8 +232,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc if (newValue.equals("page")) { final Context context = ui.getActivity(); final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages); - final String[] navTags = new String[3]; - System.arraycopy(MainActivity.NAV_DRAWER_TAGS, 0, navTags, 0, 3); + final String[] navTags = { MainActivity.NAV_DRAWER_TAGS[0], MainActivity.NAV_DRAWER_TAGS[1], MainActivity.NAV_DRAWER_TAGS[2] }; final String choice[] = { UserPreferences.getBackButtonGoToPage() }; AlertDialog.Builder builder = new AlertDialog.Builder(context); @@ -243,11 +242,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc choice[0] = navTags[i]; } }); - builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> { - if (!choice[0].equals(UserPreferences.getBackButtonGoToPage())) { - UserPreferences.setBackButtonGoToPage(choice[0]); - } - }); + builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> UserPreferences.setBackButtonGoToPage(choice[0])); builder.setNegativeButton(R.string.cancel_label, null); builder.create().show(); return true; |