Skip to content

Commit

Permalink
Move setClickListener(this) to updateUI() in ProfileStatsWidget
Browse files Browse the repository at this point in the history
This fixes a possible NPE in onClick() when user tries to go to anime /
manga list of any given user before the data has been fully loaded.

Closes: AniTrend#462
  • Loading branch information
luk1337 committed Dec 23, 2021
1 parent e3d7c6a commit fb6dfe2
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public void onInit() {
binding.userMangaChaps.setTextColor(textColor);
binding.userAnimeTotal.setTextColor(textColor);
binding.userMangaTotal.setTextColor(textColor);

binding.setClickListener(this);
}

public void updateUI() {
Expand All @@ -103,6 +101,7 @@ public void updateUI() {
binding.userMangaChaps.setText(getMangaChaptersCount(model.getManga().getChaptersRead()));
binding.userAnimeTotal.setText(getCount(model.getAnime().getCount()));
binding.userMangaTotal.setText(getCount(model.getManga().getCount()));
binding.setClickListener(this);
}
}

Expand Down

0 comments on commit fb6dfe2

Please sign in to comment.