From e436dbdf4e0c917695cacf6674ae9997faa1b6ff Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 23 Apr 2014 10:13:16 +1000 Subject: array: avoid crash on unset variable Fix the case where the variable does not exist and a pattern is specified. Courtesy of coverity Signed-off-by: Steve Bennett --- jim-array.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'jim-array.c') diff --git a/jim-array.c b/jim-array.c index bf07e07..39cd168 100644 --- a/jim-array.c +++ b/jim-array.c @@ -109,6 +109,11 @@ static int array_cmd_unset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); + if (objPtr == NULL) { + /* Doesn't exist, so nothing to do */ + return JIM_OK; + } + if (Jim_DictPairs(interp, objPtr, &dictValuesObj, &len) != JIM_OK) { return JIM_ERR; } -- cgit v1.1