mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-04 08:13:07 +00:00
fix: null checking
This commit is contained in:
@@ -24,9 +24,14 @@ public class GenreRepository {
|
|||||||
.enqueue(new Callback<ApiResponse>() {
|
.enqueue(new Callback<ApiResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getGenres() != null) {
|
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse() != null && response.body().getSubsonicResponse().getGenres() != null) {
|
||||||
List<Genre> genreList = response.body().getSubsonicResponse().getGenres().getGenres();
|
List<Genre> genreList = response.body().getSubsonicResponse().getGenres().getGenres();
|
||||||
|
|
||||||
|
if (genreList == null || genreList.isEmpty()) {
|
||||||
|
genres.setValue(Collections.emptyList());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (random) {
|
if (random) {
|
||||||
Collections.shuffle(genreList);
|
Collections.shuffle(genreList);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user