fix crash when filter request returns an error (#1150)

main
Konrad Pozniak 6 years ago committed by GitHub
parent 2eae052bf7
commit fceab89feb
  1. 13
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java

@ -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…
Cancel
Save