fix: primaryChannel IndexOutOfBoundsException

This commit is contained in:
andrekir
2023-04-14 07:26:18 -03:00
parent 97fe340587
commit 88d415f2ce

View File

@@ -41,7 +41,7 @@ data class ChannelSet(
*/
val primaryChannel: Channel?
get() = with(protobuf) {
Channel(getSettings(0), loraConfig).takeIf { settingsCount > 0 }
if (settingsCount > 0) Channel(getSettings(0), loraConfig) else null
}
/// Return an URL that represents the current channel values