esp32/machine_uart: Fix check of UART id so it only allows valid UARTs.

This commit is contained in:
Damien George 2018-01-31 19:38:32 +11:00
parent bd257a838f
commit 23f9f9495f
1 changed files with 1 additions and 1 deletions

View File

@ -187,7 +187,7 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args,
// get uart id
mp_int_t uart_num = mp_obj_get_int(args[0]);
if (uart_num < 0 || uart_num > UART_NUM_MAX) {
if (uart_num < 0 || uart_num >= UART_NUM_MAX) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "UART(%d) does not exist", uart_num));
}