Skip to content

Commit

Permalink
esp32/machine_uart: Fix check of UART id so it only allows valid UARTs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed Jan 31, 2018
1 parent bd257a8 commit 23f9f94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ports/esp32/machine_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 23f9f94

Please sign in to comment.