mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-02 05:04:37 -04:00
fix: add synchronized() to service numOnlineNodes
to avoid `ConcurrentModificationException` from nodeDBbyNodeNum changes
This commit is contained in:
@@ -427,7 +427,8 @@ class MeshService : Service(), Logging {
|
||||
/**
|
||||
* How many nodes are currently online (including our local node)
|
||||
*/
|
||||
private val numOnlineNodes get() = nodeDBbyNodeNum.values.count { it.isOnline }
|
||||
private val numOnlineNodes
|
||||
get() = synchronized(nodeDBbyNodeNum) { nodeDBbyNodeNum.values.count { it.isOnline } }
|
||||
|
||||
private fun toNodeNum(id: String): Int = when (id) {
|
||||
DataPacket.ID_BROADCAST -> DataPacket.NODENUM_BROADCAST
|
||||
|
||||
Reference in New Issue
Block a user