mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 19:31:30 +00:00
Dont crash when rotating screen in settings (fixes #806)
This commit is contained in:
parent
8bcf33b051
commit
92bf84915c
1 changed files with 5 additions and 1 deletions
|
@ -160,6 +160,9 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceConnected() {
|
public void onServiceConnected() {
|
||||||
|
if (getActivity() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
mSyncthingService = ((SyncthingActivity) getActivity()).getService();
|
mSyncthingService = ((SyncthingActivity) getActivity()).getService();
|
||||||
mSyncthingService.registerOnApiChangeListener(this);
|
mSyncthingService.registerOnApiChangeListener(this);
|
||||||
if (mSyncthingService.getApi().isConfigLoaded()) {
|
if (mSyncthingService.getApi().isConfigLoaded()) {
|
||||||
|
@ -205,7 +208,8 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mSyncthingService.unregisterOnApiChangeListener(this);
|
if (mSyncthingService != null)
|
||||||
|
mSyncthingService.unregisterOnApiChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPreferenceCategoryChangeListener(
|
private void setPreferenceCategoryChangeListener(
|
||||||
|
|
Loading…
Reference in a new issue