Prevent crash when trying to access Lc from Manager

This commit is contained in:
Sylvain Berfini 2014-10-27 11:05:26 +01:00
parent e7ffe4ab0b
commit 6551e39421

View file

@ -1230,10 +1230,10 @@ public class LinphoneManager implements LinphoneCoreListener {
public static synchronized LinphoneCore getLcIfManagerNotDestroyedOrNull() { public static synchronized LinphoneCore getLcIfManagerNotDestroyedOrNull() {
if (sExited) { if (sExited || instance == null) {
// Can occur if the UI thread play a posted event but in the meantime the LinphoneManager was destroyed // Can occur if the UI thread play a posted event but in the meantime the LinphoneManager was destroyed
// Ex: stop call and quickly terminate application. // Ex: stop call and quickly terminate application.
Log.w("Trying to get linphone core while LinphoneManager already destroyed"); Log.w("Trying to get linphone core while LinphoneManager already destroyed or not created");
return null; return null;
} }
return getLc(); return getLc();