From 889fff51031d681ec7f029a3e918b9bf11316155 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 14 May 2023 09:24:49 -0300 Subject: [PATCH] fix: fix crash on TrendingHashtagsFragment when Hashtah history is null This is the same fix applied for akkoma instances in 42ae74f1a7dc3b392a4c36428194fd13b152a28c It also applies for calckey instances --- .../fragments/discover/TrendingHashtagsFragment.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/TrendingHashtagsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/TrendingHashtagsFragment.java index e5f5a784f..31628640a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/TrendingHashtagsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/TrendingHashtagsFragment.java @@ -117,11 +117,14 @@ public class TrendingHashtagsFragment extends BaseRecyclerFragment impl @Override public void onBind(Hashtag item){ title.setText('#'+item.name); - int numPeople=item.history.get(0).accounts; - if(item.history.size()>1) - numPeople+=item.history.get(1).accounts; + int numPeople = 0; + if(item.history != null){ + numPeople=item.history.get(0).accounts; + if(item.history.size()>1) + numPeople+=item.history.get(1).accounts; + chart.setData(item.history); + } subtitle.setText(getResources().getQuantityString(R.plurals.x_people_talking, numPeople, numPeople)); - chart.setData(item.history); } @Override