Fix null pointer exception

This commit is contained in:
Margaux Clerc 2015-08-04 15:49:56 +02:00
parent a8679f992b
commit 4da9480656
2 changed files with 20 additions and 9 deletions

View file

@ -430,8 +430,10 @@ public class LinphonePreferences {
prxCfg.setIdentity(identity); prxCfg.setIdentity(identity);
prxCfg.done(); prxCfg.done();
if(info != null) {
info.setUsername(username); info.setUsername(username);
saveAuthInfo(info); saveAuthInfo(info);
}
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -468,9 +470,11 @@ public class LinphonePreferences {
public void setAccountUserId(int n, String userId) { public void setAccountUserId(int n, String userId) {
LinphoneAuthInfo info = getClonedAuthInfo(n); LinphoneAuthInfo info = getClonedAuthInfo(n);
if(info != null) {
info.setUserId(userId); info.setUserId(userId);
saveAuthInfo(info); saveAuthInfo(info);
} }
}
public String getAccountUserId(int n) { public String getAccountUserId(int n) {
LinphoneAuthInfo authInfo = getAuthInfo(n); LinphoneAuthInfo authInfo = getAuthInfo(n);
@ -479,9 +483,11 @@ public class LinphonePreferences {
public void setAccountPassword(int n, String password) { public void setAccountPassword(int n, String password) {
LinphoneAuthInfo info = getClonedAuthInfo(n); LinphoneAuthInfo info = getClonedAuthInfo(n);
if(info != null) {
info.setPassword(password); info.setPassword(password);
saveAuthInfo(info); saveAuthInfo(info);
} }
}
public String getAccountPassword(int n) { public String getAccountPassword(int n) {
LinphoneAuthInfo authInfo = getAuthInfo(n); LinphoneAuthInfo authInfo = getAuthInfo(n);
@ -492,8 +498,10 @@ public class LinphonePreferences {
try { try {
LinphoneAuthInfo authInfo = getClonedAuthInfo(n); LinphoneAuthInfo authInfo = getClonedAuthInfo(n);
if(authInfo != null) {
authInfo.setDomain(domain); authInfo.setDomain(domain);
saveAuthInfo(authInfo); saveAuthInfo(authInfo);
}
LinphoneProxyConfig prxCfg = getProxyConfig(n); LinphoneProxyConfig prxCfg = getProxyConfig(n);
prxCfg.edit(); prxCfg.edit();
@ -1026,7 +1034,7 @@ public class LinphonePreferences {
} }
public boolean isAutoStartEnabled() { public boolean isAutoStartEnabled() {
return getConfig().getBool("app", "auto_start", false); return getConfig().getBool("app", "auto_start", true);
} }
public void setAutoStart(boolean autoStartEnabled) { public void setAutoStart(boolean autoStartEnabled) {

View file

@ -309,6 +309,9 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
username = username.substring(4); username = username.substring(4);
} }
if (username.contains("@"))
username = username.split("@")[0];
if(domain.startsWith("sip:")) { if(domain.startsWith("sip:")) {
domain = domain.substring(4); domain = domain.substring(4);
} }