fix 'jtag interface' behavior

Without this patch, running "openocd -c 'jtag interface'" segfaults.
Now, it returns the string "undefined" when the interface is unset.
__archive__
Zachary T Welch 2009-11-10 23:10:26 -08:00
parent 158698e333
commit 5e1b500b17
1 changed files with 2 additions and 1 deletions

View File

@ -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)");
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;
case JTAG_CMD_INIT:
if (goi.argc != 0) {