Fixes some crashes

This commit is contained in:
stom79 2018-08-30 17:49:26 +02:00
parent b103f661a9
commit feb45c5f93
2 changed files with 24 additions and 18 deletions

View File

@ -135,6 +135,7 @@ public class ProxyActivity extends BaseActivity {
String proxy_passwordVal = proxy_password.getText().toString().trim();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.SET_PROXY_HOST, hostVal);
if( portVal.matches("\\d+") )
editor.putInt(Helper.SET_PROXY_PORT, Integer.parseInt(portVal));
editor.putString(Helper.SET_PROXY_LOGIN, proxy_loginVal);
editor.putString(Helper.SET_PROXY_PASSWORD, proxy_passwordVal);

View File

@ -106,6 +106,7 @@ public class LiveNotificationService extends Service {
int type = sharedpreferences.getInt(Helper.SET_PROXY_TYPE, 0);
proxy = null;
if( proxyEnabled ){
try{
String host = sharedpreferences.getString(Helper.SET_PROXY_HOST, "127.0.0.1");
int port = sharedpreferences.getInt(Helper.SET_PROXY_PORT, 8118);
if( type == 0 )
@ -124,6 +125,10 @@ public class LiveNotificationService extends Service {
};
Authenticator.setDefault(authenticator);
}
}catch (Exception e){
proxy = null;
}
}
if( intent == null || intent.getBooleanExtra("stop", false) ) {
stop = true;