t-runner: Check for NULL before using strcmp

This commit is contained in:
Tim Kourt 2019-10-22 16:13:16 -07:00 committed by Denis Kenzior
parent e859e98869
commit e3551ab56b
1 changed files with 3 additions and 3 deletions

View File

@ -2957,9 +2957,9 @@ int main(int argc, char *argv[])
break;
case 'g':
gdb_opt = optarg;
if (!(!strcmp(gdb_opt, "iwd") ||
!strcmp(gdb_opt, "hostapd") ||
!strcmp(gdb_opt, "hwsim"))) {
if (!gdb_opt || (strcmp(gdb_opt, "iwd") &&
strcmp(gdb_opt, "hostapd") &&
strcmp(gdb_opt, "hwsim"))) {
l_error("--gdb can only be used with iwd"
", hwsim or hostapd");
return EXIT_FAILURE;