main: always check if board is not null before access

This commit is contained in:
Gwenhael Goavec-Merou 2022-05-28 17:20:53 +02:00
parent 13c5bbb98f
commit 26ea58c305
1 changed files with 2 additions and 2 deletions

View File

@ -252,7 +252,7 @@ int main(int argc, char **argv)
spi_ret = EXIT_FAILURE;
} else {
RawParser *bit = NULL;
if (board->reset_pin) {
if (board && board->reset_pin) {
spi->gpio_set_output(board->reset_pin, true);
spi->gpio_clear(board->reset_pin, true);
}
@ -302,7 +302,7 @@ int main(int argc, char **argv)
if (!flash.enable_protection(args.protect_flash))
spi_ret = EXIT_FAILURE;
if (board->reset_pin)
if (board && board->reset_pin)
spi->gpio_set(board->reset_pin, true);
}