mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +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,6 +208,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
if (mSyncthingService != null)
|
||||||
mSyncthingService.unregisterOnApiChangeListener(this);
|
mSyncthingService.unregisterOnApiChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue