1
0
Fork 0
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:
Felix Ableitner 2016-12-12 15:38:50 +09:00
parent 8bcf33b051
commit 92bf84915c

View file

@ -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,6 +208,7 @@ public class SettingsActivity extends SyncthingActivity {
@Override
public void onDestroy() {
super.onDestroy();
if (mSyncthingService != null)
mSyncthingService.unregisterOnApiChangeListener(this);
}