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(); LinphoneManager.destroy();
// Make sure our notification is gone. // 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 // This will prevent the app from crashing if the service gets killed in background mode
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {

View file

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