fix crash when filter request returns an error (#1150)
This commit is contained in:
parent
2e52457b32
commit
291a923d51
1 changed files with 9 additions and 4 deletions
|
@ -319,13 +319,18 @@ public class TimelineFragment extends SFragment implements
|
||||||
private void reloadFilters(boolean refresh) {
|
private void reloadFilters(boolean refresh) {
|
||||||
mastodonApi.getFilters().enqueue(new Callback<List<Filter>>() {
|
mastodonApi.getFilters().enqueue(new Callback<List<Filter>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<List<Filter>> call, Response<List<Filter>> response) {
|
public void onResponse(@NonNull Call<List<Filter>> call, @NonNull Response<List<Filter>> response) {
|
||||||
applyFilters(response.body(), refresh);
|
List<Filter> filterList = response.body();
|
||||||
|
if(response.isSuccessful() && filterList != null) {
|
||||||
|
applyFilters(filterList, refresh);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Error getting filters from server");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<List<Filter>> call, Throwable t) {
|
public void onFailure(@NonNull Call<List<Filter>> call, @NonNull Throwable t) {
|
||||||
Log.e(TAG, "Error getting filters from server");
|
Log.e(TAG, "Error getting filters from server", t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue