Fixed potential problem if proxy config doesn't have nat policy
This commit is contained in:
parent
7833ed95be
commit
95444bf563
1 changed files with 16 additions and 0 deletions
|
@ -325,6 +325,13 @@ public class AccountSettingsFragment extends Fragment {
|
||||||
if (mProxyConfig != null) {
|
if (mProxyConfig != null) {
|
||||||
mProxyConfig.edit();
|
mProxyConfig.edit();
|
||||||
NatPolicy natPolicy = mProxyConfig.getNatPolicy();
|
NatPolicy natPolicy = mProxyConfig.getNatPolicy();
|
||||||
|
if (natPolicy == null) {
|
||||||
|
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (core != null) {
|
||||||
|
natPolicy = core.createNatPolicy();
|
||||||
|
mProxyConfig.setNatPolicy(natPolicy);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (natPolicy != null) {
|
if (natPolicy != null) {
|
||||||
natPolicy.setStunServer(newValue);
|
natPolicy.setStunServer(newValue);
|
||||||
}
|
}
|
||||||
|
@ -444,7 +451,16 @@ public class AccountSettingsFragment extends Fragment {
|
||||||
public void onBoolValueChanged(boolean newValue) {
|
public void onBoolValueChanged(boolean newValue) {
|
||||||
if (mProxyConfig != null) {
|
if (mProxyConfig != null) {
|
||||||
mProxyConfig.edit();
|
mProxyConfig.edit();
|
||||||
|
|
||||||
NatPolicy natPolicy = mProxyConfig.getNatPolicy();
|
NatPolicy natPolicy = mProxyConfig.getNatPolicy();
|
||||||
|
if (natPolicy == null) {
|
||||||
|
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (core != null) {
|
||||||
|
natPolicy = core.createNatPolicy();
|
||||||
|
mProxyConfig.setNatPolicy(natPolicy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (natPolicy != null) {
|
if (natPolicy != null) {
|
||||||
natPolicy.enableIce(newValue);
|
natPolicy.enableIce(newValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue