fix: null checking

This commit is contained in:
antonio 2023-11-05 16:43:13 +01:00
parent 5d4dfe1ac7
commit 9aadcb91fb
3 changed files with 11 additions and 5 deletions

View file

@ -706,7 +706,9 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
private void refreshSharesView() {
final Handler handler = new Handler();
final Runnable runnable = () -> {
if (Preferences.isSharingEnabled()) homeViewModel.refreshShares(getViewLifecycleOwner());
if (getView() != null && bind != null && Preferences.isSharingEnabled()) {
homeViewModel.refreshShares(getViewLifecycleOwner());
}
};
handler.postDelayed(runnable, 100);
}

View file

@ -254,7 +254,12 @@ public class LibraryFragment extends Fragment implements ClickCallback {
private void refreshPlaylistView() {
final Handler handler = new Handler();
final Runnable runnable = () -> libraryViewModel.refreshPlaylistSample(getViewLifecycleOwner());
final Runnable runnable = () -> {
if (getView() != null && bind != null && libraryViewModel != null)
libraryViewModel.refreshPlaylistSample(getViewLifecycleOwner());
};
handler.postDelayed(runnable, 100);
}