comboctl-main: Add more argument checks to Pump.connect()
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
parent
605fe04d74
commit
90480ab1d9
1 changed files with 1 additions and 0 deletions
|
@ -899,6 +899,7 @@ class Pump(
|
||||||
*/
|
*/
|
||||||
suspend fun connect(maxNumAttempts: Int? = DEFAULT_MAX_NUM_REGULAR_CONNECT_ATTEMPTS) {
|
suspend fun connect(maxNumAttempts: Int? = DEFAULT_MAX_NUM_REGULAR_CONNECT_ATTEMPTS) {
|
||||||
check(stateFlow.value == State.Disconnected) { "Attempted to connect to pump in the ${stateFlow.value} state" }
|
check(stateFlow.value == State.Disconnected) { "Attempted to connect to pump in the ${stateFlow.value} state" }
|
||||||
|
check((maxNumAttempts == null) || (maxNumAttempts > 0))
|
||||||
|
|
||||||
val actualMaxNumAttempts = maxNumAttempts ?: Int.MAX_VALUE
|
val actualMaxNumAttempts = maxNumAttempts ?: Int.MAX_VALUE
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue