diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-10 23:10:26 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-11 14:04:06 -0800 |
commit | 5e1b500b173c7abaf9b78e32d31140c1bd4ba090 (patch) | |
tree | 8d412d147d01b705c201da5f2846238d84daed5e | |
parent | 158698e3331b446243b863ab8b58ebee2c56f0cc (diff) |
fix 'jtag interface' behavior
Without this patch, running "openocd -c 'jtag interface'" segfaults.
Now, it returns the string "undefined" when the interface is unset.
-rw-r--r-- | src/jtag/tcl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 71efc8b5..b86e006a 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -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) { |