Fix compilation from eclipse causing crash because of null string

This commit is contained in:
Sylvain Berfini 2013-01-16 11:12:47 +01:00
parent cda71d1ae7
commit 2dc8137dbb

View file

@ -416,16 +416,18 @@ public final class LinphoneManager implements LinphoneCoreListener {
try { try {
copyAssetsFromPackage(); copyAssetsFromPackage();
//traces alway start with traces enable to not missed first initialization //traces alway start with traces enable to not missed first initialization
;
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && getPrefBoolean(R.string.pref_debug_key, mR.getBoolean(R.bool.pref_debug_default)); boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && getPrefBoolean(R.string.pref_debug_key, mR.getBoolean(R.bool.pref_debug_default));
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
mLc = LinphoneCoreFactory.instance().createLinphoneCore( mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneInitialConfigFile, null);
this, mLinphoneConfigFile, mLinphoneInitialConfigFile, null);
mLc.setContext(c); mLc.setContext(c);
try { try {
mLc.setUserAgent("LinphoneAndroid", c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName); String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
if (versionName == null) {
versionName = String.valueOf(c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionCode);
}
mLc.setUserAgent("LinphoneAndroid", versionName);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
Log.e(e, "cannot get version name"); Log.e(e, "cannot get version name");
} }
@ -516,7 +518,9 @@ public final class LinphoneManager implements LinphoneCoreListener {
} }
private void initFromConfTunnel(){ private void initFromConfTunnel(){
if (!mLc.isTunnelAvailable()) return; if (!mLc.isTunnelAvailable())
return;
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
mLc.tunnelCleanServers(); mLc.tunnelCleanServers();
String host = getString(R.string.tunnel_host); String host = getString(R.string.tunnel_host);
@ -536,7 +540,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (!getPrefBoolean(getString(R.string.pref_disable_account_key) + key, false)) { if (!getPrefBoolean(getString(R.string.pref_disable_account_key) + key, false)) {
initAccount(key, i == getPrefInt(R.string.pref_default_account_key, 0)); initAccount(key, i == getPrefInt(R.string.pref_default_account_key, 0));
} }
} }
LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig(); LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig();