fix: incorrect admin channel index retrieval logic

was returning -1 instead of 0 when no admin channel configured.
This commit is contained in:
andrekir 2023-05-24 06:17:32 -03:00
parent 9869a9208b
commit 93ac0186fe

View file

@ -457,7 +457,8 @@ class MeshService : Service(), Logging {
/// Admin channel index
private val adminChannelIndex: Int
get() = channelSet.settingsList.map { it.name.lowercase() }.indexOf("admin")
get() = channelSet.settingsList.indexOfFirst { it.name.lowercase() == "admin" }
.coerceAtLeast(0)
/// Generate a new mesh packet builder with our node as the sender, and the specified node num
private fun newMeshPacketTo(idNum: Int) = MeshPacket.newBuilder().apply {