apix-gpio-example: fix invalid NULL check for controller names

Replace incorrect NULL pointer checks on button_ctrl and led_ctrl with
string emptiness checks, since these are fixed-size character arrays and
never NULL.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2025-06-18 15:50:46 +02:00
parent 85480c9f26
commit 67b6d9ed60
1 changed files with 2 additions and 2 deletions

View File

@ -163,8 +163,8 @@ int main(int argc, char *argv[])
usage_and_exit(name, EXIT_FAILURE);
}
if (button_ctrl == NULL || button_line < 0 ||
led_ctrl == NULL || led_line < 0) {
if (button_ctrl[0] == '\0' || button_line < 0 ||
led_ctrl[0] == '\0' || led_line < 0) {
printf("Unable to parse button and led GPIOs\n");
return EXIT_FAILURE;
}