Fixed crash reported by play store

This commit is contained in:
Sylvain Berfini 2019-12-10 10:28:44 +01:00
parent 3c93974534
commit 26b276d62c
3 changed files with 12 additions and 2 deletions

View file

@ -332,6 +332,8 @@ public class LinphoneManager implements SensorEventListener {
}
public static synchronized Core getCore() {
if (!LinphoneContext.isReady()) return null;
if (getInstance().mExited) {
// Can occur if the UI thread play a posted event but in the meantime the
// LinphoneManager was destroyed

View file

@ -419,7 +419,11 @@ public abstract class MainActivity extends LinphoneGenericActivity
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
try {
startActivity(intent);
} catch (IllegalStateException ise) {
Log.e("[Main Activity] Can't start home activity: ", ise);
}
}
private void quit() {

View file

@ -89,7 +89,11 @@ public class CallStatsFragment extends Fragment {
@Override
public void onPause() {
super.onPause();
LinphoneManager.getCore().removeListener(mListener);
Core core = LinphoneManager.getCore();
if (core != null) {
core.removeListener(mListener);
}
}
public void setDrawer(DrawerLayout drawer, RelativeLayout content) {