diff options
-rw-r--r-- | src/openocd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/openocd.c b/src/openocd.c index 50eb99e0..f4aa4517 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -360,10 +360,14 @@ int jim_command(command_context_t *context, char *line) if (retcode == JIM_ERR) { Jim_PrintErrorMessage(interp); long t; - if (Jim_GetLong(interp, Jim_GetVariableStr(interp, "openocd_result", JIM_ERRMSG), &t)==JIM_OK) + Jim_Obj *openocd_result=Jim_GetVariableStr(interp, "openocd_result", JIM_ERRMSG); + if (openocd_result) { - return t; - } + if (Jim_GetLong(interp, openocd_result, &t)==JIM_OK) + { + return t; + } + } return ERROR_FAIL; } const char *result; |