瀏覽代碼

Merge pull request #2800 from nextcloud/bugfix/noid/avoidNpeForUnreadBubble

Bugfix/noid/avoid npe for unread bubble
Andy Scherzinger 2 年之前
父節點
當前提交
f1fd334b64
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

+ 9 - 6
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -2533,14 +2533,17 @@ class ChatController(args: Bundle) :
 
     private fun modifyMessageCount(shouldAddNewMessagesNotice: Boolean, shouldScroll: Boolean) {
         if (!shouldAddNewMessagesNotice && !shouldScroll) {
-            if (!binding?.popupBubbleView?.isShown!!) {
-                newMessagesCount = 1
-                binding?.scrollDownButton?.visibility = View.GONE
-                binding?.popupBubbleView?.show()
-            } else if (binding?.popupBubbleView?.isShown!!) {
-                newMessagesCount++
+            binding?.popupBubbleView?.isShown?.let {
+                if (it) {
+                    newMessagesCount++
+                } else {
+                    newMessagesCount = 1
+                    binding?.scrollDownButton?.visibility = View.GONE
+                    binding?.popupBubbleView?.show()
+                }
             }
         } else {
+            binding?.scrollDownButton?.visibility = View.GONE
             newMessagesCount = 0
         }
     }