Fixed crashs

This commit is contained in:
Sylvain Berfini 2019-04-07 18:23:23 +02:00
parent 5172bcf5be
commit b52bd60ca3
2 changed files with 10 additions and 2 deletions

View file

@ -404,7 +404,9 @@ public final class LinphoneService extends Service {
LinphoneManager.destroy();
// Make sure our notification is gone.
mNotificationManager.destroy();
if (mNotificationManager != null) {
mNotificationManager.destroy();
}
// This will prevent the app from crashing if the service gets killed in background mode
if (LinphoneActivity.isInstanciated()) {

View file

@ -101,6 +101,10 @@ public class NetworkSettingsFragment extends Fragment {
mAndroidBatterySaverSettings =
mRootView.findViewById(R.id.pref_android_battery_protected_settings);
mAndroidBatterySaverSettings.setVisibility(
DeviceUtils.hasDevicePowerManager(LinphoneActivity.instance())
? View.VISIBLE
: View.GONE);
}
protected void setListeners() {
@ -209,7 +213,9 @@ public class NetworkSettingsFragment extends Fragment {
Intent intent =
DeviceUtils.getDevicePowerManagerIntent(
LinphoneActivity.instance());
startActivity(intent);
if (intent != null) {
startActivity(intent);
}
}
});
}