瀏覽代碼

fix to show vote results if only "poll.votes" are available

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 年之前
父節點
當前提交
0388f3e3f6
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt

+ 4 - 1
app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt

@@ -115,7 +115,10 @@ class PollResultsFragment(
             val oneVoteInPercent = 100 / votersAmount
 
             poll.options?.forEachIndexed { index, option ->
-                val votersForThisOption = poll.votes?.filter { it.key.toInt() == index }?.size!!
+                var votersForThisOption = poll.votes.filter { it.key.toInt() == index }[index.toString()]
+                if (votersForThisOption == null) {
+                    votersForThisOption = 0
+                }
                 val optionsPercent = oneVoteInPercent * votersForThisOption
 
                 val pollResultItem = PollResultItem(option, optionsPercent)