fix autobug crash when primary channel is null

This commit is contained in:
Kevin Hester 2021-03-17 15:37:09 +08:00
parent fa17c4efe1
commit 98356b9205
5 changed files with 53 additions and 48 deletions

View file

@ -47,9 +47,11 @@ data class ChannelSet(
/**
* Return the primary channel info
*/
val primaryChannel: Channel get() {
return Channel(protobuf.getSettings(0))
}
val primaryChannel: Channel? get() =
if(protobuf.settingsCount > 0)
Channel(protobuf.getSettings(0))
else
null
/// Return an URL that represents the current channel values
/// @param upperCasePrefix - portions of the URL can be upper case to make for more efficient QR codes