Fix log crash

This commit is contained in:
世界 2024-11-13 10:43:42 +08:00
parent 6b8b5562ae
commit 5ea67840f8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -139,12 +139,12 @@ class LogFragment : Fragment(), CommandClient.Handler {
lifecycleScope.launch(Dispatchers.Main) {
val messageLen = messageList.size
val removeLen = logList.size + messageLen - 300
logList.addAll(messageList)
if (removeLen > 0) {
repeat(removeLen) {
logList.removeFirst()
}
}
logList.addAll(messageList)
updateViews(removeLen, messageLen)
}
}