target/arm_dap: fix segmentation fault in 'dap info' cmd

'dap info' command fails hard on a hla target.

Change-Id: Ia188b1afe527e0ed64512d1bddadd507f978e40b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4860
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tomas Vanek 2019-01-19 15:58:49 +01:00 committed by Matthias Welwarsky
parent 8896abbf07
commit 418515b21e
1 changed files with 5 additions and 0 deletions

View File

@ -313,6 +313,11 @@ COMMAND_HANDLER(handle_dap_info_command)
struct adiv5_dap *dap = arm->dap;
uint32_t apsel;
if (dap == NULL) {
LOG_ERROR("DAP instance not available. Probably a HLA target...");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
switch (CMD_ARGC) {
case 0:
apsel = dap->apsel;