From 26ea58c305f2d91052686b84a3cfffcfc4b0b027 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 28 May 2022 17:20:53 +0200 Subject: [PATCH] main: always check if board is not null before access --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7324b29..1915631 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); }