From d9cd92810089a8080e2cfc60787cdc791e85e184 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 2 Mar 2016 23:23:52 +0100 Subject: [PATCH] fixed audio settings changed bug --- .../org/schabi/newpipe/SettingsActivity.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java index bad716bb3..04b084154 100644 --- a/app/src/main/java/org/schabi/newpipe/SettingsActivity.java +++ b/app/src/main/java/org/schabi/newpipe/SettingsActivity.java @@ -119,18 +119,20 @@ public class SettingsActivity extends PreferenceActivity { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity a = getActivity(); - updateSummary(); + if(a != null) { + updateSummary(); - if (defaultPreferences.getBoolean(USE_TOR_KEY, false)) { - if (OrbotHelper.isOrbotInstalled(a)) { - App.configureTor(true); - OrbotHelper.requestStartTor(a); + if (defaultPreferences.getBoolean(USE_TOR_KEY, false)) { + if (OrbotHelper.isOrbotInstalled(a)) { + App.configureTor(true); + OrbotHelper.requestStartTor(a); + } else { + Intent intent = OrbotHelper.getOrbotInstallIntent(a); + a.startActivityForResult(intent, REQUEST_INSTALL_ORBOT); + } } else { - Intent intent = OrbotHelper.getOrbotInstallIntent(a); - a.startActivityForResult(intent, REQUEST_INSTALL_ORBOT); + App.configureTor(false); } - } else { - App.configureTor(false); } } };