mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-02 05:04:37 -04:00
fix: add nodeDBbyNodeNum temp var to avoid concurrent modifications
This commit is contained in:
@@ -309,6 +309,7 @@ class MeshService : Service(), Logging {
|
||||
/// Save information about our mesh to disk, so we will have it when we next start the service (even before we hear from our device)
|
||||
private fun saveSettings() {
|
||||
myNodeInfo?.let { myInfo ->
|
||||
val nodeDBbyNodeNum = nodeDBbyNodeNum.toMap()
|
||||
val settings = MeshServiceSettingsData(
|
||||
myInfo = myInfo,
|
||||
nodeDB = nodeDBbyNodeNum.values.toTypedArray(),
|
||||
@@ -392,17 +393,6 @@ class MeshService : Service(), Logging {
|
||||
/// Map a nodenum to a node, or throw an exception if not found
|
||||
private fun toNodeInfo(n: Int) = nodeDBbyNodeNum[n] ?: throw NodeNumNotFoundException(n)
|
||||
|
||||
/**
|
||||
* Return the nodeinfo for the local node, or null if not found
|
||||
*/
|
||||
private val localNodeInfo
|
||||
get(): NodeInfo? =
|
||||
try {
|
||||
toNodeInfo(myNodeNum)
|
||||
} catch (ex: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
/** Map a nodeNum to the nodeId string
|
||||
If we have a NodeInfo for this ID we prefer to return the string ID inside the user record.
|
||||
but some nodes might not have a user record at all (because not yet received), in that case, we return
|
||||
|
||||
Reference in New Issue
Block a user