mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11: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
|
||||
public void onServiceConnected() {
|
||||
if (getActivity() == null)
|
||||
return;
|
||||
|
||||
mSyncthingService = ((SyncthingActivity) getActivity()).getService();
|
||||
mSyncthingService.registerOnApiChangeListener(this);
|
||||
if (mSyncthingService.getApi().isConfigLoaded()) {
|
||||
|
@ -205,7 +208,8 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mSyncthingService.unregisterOnApiChangeListener(this);
|
||||
if (mSyncthingService != null)
|
||||
mSyncthingService.unregisterOnApiChangeListener(this);
|
||||
}
|
||||
|
||||
private void setPreferenceCategoryChangeListener(
|
||||
|
|
Loading…
Reference in a new issue