summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 23:10:26 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-11 14:04:06 -0800
commit5e1b500b173c7abaf9b78e32d31140c1bd4ba090 (patch)
tree8d412d147d01b705c201da5f2846238d84daed5e /src
parent158698e3331b446243b863ab8b58ebee2c56f0cc (diff)
downloadopenocd+libswd-5e1b500b173c7abaf9b78e32d31140c1bd4ba090.tar.gz
openocd+libswd-5e1b500b173c7abaf9b78e32d31140c1bd4ba090.tar.bz2
openocd+libswd-5e1b500b173c7abaf9b78e32d31140c1bd4ba090.tar.xz
openocd+libswd-5e1b500b173c7abaf9b78e32d31140c1bd4ba090.zip
fix 'jtag interface' behavior
Without this patch, running "openocd -c 'jtag interface'" segfaults. Now, it returns the string "undefined" when the interface is unset.
Diffstat (limited to 'src')
-rw-r--r--src/jtag/tcl.c3
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) {