Fix possible crash in the onTaskRemoved() method of LinphoneService if the LinphoneManager has already been destroyed.
This commit is contained in:
parent
29b2621dca
commit
a3bbd0b5ef
2 changed files with 3 additions and 2 deletions
|
@ -487,7 +487,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
|
|
||||||
if (sExited) {
|
if (sExited) {
|
||||||
throw new RuntimeException("Linphone Manager was already destroyed. "
|
throw new RuntimeException("Linphone Manager was already destroyed. "
|
||||||
+ "Better use getLcIfManagerNotDestroyed and check returned value");
|
+ "Better use getLcIfManagerNotDestroyedOrNull and check returned value");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException("Linphone Manager should be created before accessed");
|
throw new RuntimeException("Linphone Manager should be created before accessed");
|
||||||
|
|
|
@ -801,7 +801,8 @@ public final class LinphoneService extends Service {
|
||||||
|
|
||||||
// If push is enabled, don't unregister account, otherwise do unregister
|
// If push is enabled, don't unregister account, otherwise do unregister
|
||||||
if (LinphonePreferences.instance().isPushNotificationEnabled()) {
|
if (LinphonePreferences.instance().isPushNotificationEnabled()) {
|
||||||
LinphoneManager.getLc().setNetworkReachable(false);
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) lc.setNetworkReachable(false);
|
||||||
}
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue