fix(custom-local-timelines): fix NPE in ended polls. Fixes #110

This commit is contained in:
LucasGGamerM
2023-03-20 16:09:06 -03:00
parent c0484de506
commit 56e5877040

View File

@@ -92,7 +92,11 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{
progressBg.setLevel(Math.round(10000f*item.votesFraction));
button.setBackground(progressBg);
itemView.setSelected(item.isMostVoted);
if(item.poll.ownVotes == null){
icon.setSelected(false);
}else{
icon.setSelected(item.poll.ownVotes.contains(item.poll.options.indexOf(item.option)));
}
icon.setVisibility(item.poll.voted && item.poll.ownVotes.isEmpty() ? View.GONE : View.VISIBLE);
percent.setText(String.format(Locale.getDefault(), "%d%%", Math.round(item.votesFraction*100f)));
}else{