From: Zachary T Welch Date: Wed, 11 Nov 2009 07:10:26 +0000 (-0800) Subject: fix 'jtag interface' behavior X-Git-Tag: v0.4.0-rc1~824 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5e1b500b173c7abaf9b78e32d31140c1bd4ba090;p=openocd fix 'jtag interface' behavior Without this patch, running "openocd -c 'jtag interface'" segfaults. Now, it returns the string "undefined" when the interface is unset. --- 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) {