Some fix to avoid crash

This commit is contained in:
Erwan Croze 2017-11-15 15:09:23 +01:00
parent 946cb24eb3
commit d7302206dc
4 changed files with 15 additions and 6 deletions

View file

@ -42,7 +42,11 @@ public class BootReceiver extends BroadcastReceiver {
if (autostart) { if (autostart) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN); Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
lLinphoneServiceIntent.setClass(context, LinphoneService.class); lLinphoneServiceIntent.setClass(context, LinphoneService.class);
context.startService(lLinphoneServiceIntent); try {
context.startService(lLinphoneServiceIntent);
} catch (RuntimeException e) {
Log.e(e);
}
} }
} }
} }

View file

@ -1401,8 +1401,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
try { try {
if (mLc.getCallsNb() > 0) { if (mLc.getCallsNb() > 0) {
mLc.acceptCall(call); mLc.acceptCall(call);
LinphoneManager.getInstance().routeAudioToReceiver(); if (LinphoneManager.getInstance() != null) {
LinphoneActivity.instance().startIncallActivity(call); LinphoneManager.getInstance().routeAudioToReceiver();
if (LinphoneActivity.instance() != null)
LinphoneActivity.instance().startIncallActivity(call);
}
} }
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
Log.e(e); Log.e(e);

View file

@ -728,7 +728,7 @@ public final class LinphoneUtils {
} }
public static void displayErrorAlert(String msg, Context ctxt) { public static void displayErrorAlert(String msg, Context ctxt) {
if (ctxt != null) { if (ctxt != null && msg != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
builder.setMessage(msg) builder.setMessage(msg)
.setCancelable(false) .setCancelable(false)

View file

@ -138,8 +138,10 @@ private static AssistantActivity instance;
mPrefs = LinphonePreferences.instance(); mPrefs = LinphonePreferences.instance();
status.enableSideMenu(false); status.enableSideMenu(false);
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
accountCreator.setListener(this); accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this);
}
countryListAdapter = new CountryListAdapter(getApplicationContext()); countryListAdapter = new CountryListAdapter(getApplicationContext());
mListener = new LinphoneCoreListenerBase() { mListener = new LinphoneCoreListenerBase() {