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) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
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 {
if (mLc.getCallsNb() > 0) {
mLc.acceptCall(call);
LinphoneManager.getInstance().routeAudioToReceiver();
LinphoneActivity.instance().startIncallActivity(call);
if (LinphoneManager.getInstance() != null) {
LinphoneManager.getInstance().routeAudioToReceiver();
if (LinphoneActivity.instance() != null)
LinphoneActivity.instance().startIncallActivity(call);
}
}
} catch (LinphoneCoreException e) {
Log.e(e);

View file

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

View file

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