From fb6dfe2bb41edfdd14c53cde064c284959cb840c Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Thu, 23 Dec 2021 21:47:10 +0100 Subject: [PATCH] Move setClickListener(this) to updateUI() in ProfileStatsWidget 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: #462 --- .../anitrend/base/custom/view/widget/ProfileStatsWidget.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/mxt/anitrend/base/custom/view/widget/ProfileStatsWidget.java b/app/src/main/java/com/mxt/anitrend/base/custom/view/widget/ProfileStatsWidget.java index dec9876c9..1c3180521 100644 --- a/app/src/main/java/com/mxt/anitrend/base/custom/view/widget/ProfileStatsWidget.java +++ b/app/src/main/java/com/mxt/anitrend/base/custom/view/widget/ProfileStatsWidget.java @@ -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() { @@ -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); } }