Check CMSIS-DAP adapter has serialnumber before pass it to wcscmp.
Keep looking for onother adapter if choosed one doesn't have correct
serialnumber.
Change-Id: I7d386a03cb49b9baf22073ae1c6b14269ed3b618
Signed-off-by: Andrii Anpilogov <anpilog@gmail.com>
Reviewed-on: http://openocd.zylin.com/3226
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
/* we have found an adapter, so exit further checks */
/* check serial number matches if given */
if (cmsis_dap_serial != NULL) {
- if (wcscmp(cmsis_dap_serial, cur_dev->serial_number) == 0) {
+ if ((cur_dev->serial_number != NULL) && wcscmp(cmsis_dap_serial, cur_dev->serial_number) == 0) {
serial_found = true;
break;
}
} else
break;
+
+ found = false;
}
cur_dev = cur_dev->next;