Bugfix: prevent NPE in onDestroy.
@@ -160,8 +160,12 @@ public class StatisticsRecordingFragment extends Fragment {
super.onDestroy();
trackRecordingServiceConnection = null;
viewModel = null;
+
+ if (statisticsLiveData != null) {
statisticsLiveData.removeObservers(getActivity());
}
+ statisticsLiveData = null;
+ }
private void updateUI() {
if (isResumed()) {
