fix 'jtag interface' behavior
Without this patch, running "openocd -c 'jtag interface'" segfaults. Now, it returns the string "undefined" when the interface is unset.
This commit is contained in:
parent
158698e333
commit
5e1b500b17
src/jtag
|
@ -422,7 +422,8 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||||
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
|
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
|
||||||
return JIM_ERR;
|
return JIM_ERR;
|
||||||
}
|
}
|
||||||
Jim_SetResultString(goi.interp, jtag_interface->name, -1);
|
const char *name = jtag_interface ? jtag_interface->name : NULL;
|
||||||
|
Jim_SetResultString(goi.interp, name ? : "undefined", -1);
|
||||||
return JIM_OK;
|
return JIM_OK;
|
||||||
case JTAG_CMD_INIT:
|
case JTAG_CMD_INIT:
|
||||||
if (goi.argc != 0) {
|
if (goi.argc != 0) {
|
||||||
|
|
Loading…
Reference in New Issue