diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2015-06-30 14:39:56 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2015-06-30 14:39:56 (GMT) |
commit | 6af49e65ad4e40ab1d8f93821728698b1af3f58b (patch) | |
tree | 7c1aa37ac63fd249aaeddd6d536393466b809dbf /generic | |
parent | 12cc9a424d499dea65f4b5aa8b623d0204c5e23c (diff) | |
parent | f63cfcaea332810df5d6982d910c6337db6847fa (diff) | |
download | tcl-6af49e65ad4e40ab1d8f93821728698b1af3f58b.zip tcl-6af49e65ad4e40ab1d8f93821728698b1af3f58b.tar.gz tcl-6af49e65ad4e40ab1d8f93821728698b1af3f58b.tar.bz2 |
Correct handling of dictionaries in the background error processing code.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclEvent.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 6ca22a6..406eeba 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -263,7 +263,7 @@ HandleBgErrors( if (errChannel != NULL) { Tcl_Obj *options = Tcl_GetReturnOptions(interp, code); - Tcl_Obj *keyPtr, *valuePtr; + Tcl_Obj *keyPtr, *valuePtr = NULL; TclNewLiteralStringObj(keyPtr, "-errorinfo"); Tcl_IncrRefCount(keyPtr); @@ -315,7 +315,7 @@ TclDefaultBgErrorHandlerObjCmd( { Tcl_Obj *keyPtr, *valuePtr; Tcl_Obj *tempObjv[2]; - int code, level; + int result, code, level; Tcl_InterpState saved; if (objc != 3) { @@ -329,9 +329,9 @@ TclDefaultBgErrorHandlerObjCmd( TclNewLiteralStringObj(keyPtr, "-level"); Tcl_IncrRefCount(keyPtr); - Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); + result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); Tcl_DecrRefCount(keyPtr); - if (valuePtr == NULL) { + if (result != TCL_OK || valuePtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing return option \"-level\"", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); @@ -342,9 +342,9 @@ TclDefaultBgErrorHandlerObjCmd( } TclNewLiteralStringObj(keyPtr, "-code"); Tcl_IncrRefCount(keyPtr); - Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); + result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); Tcl_DecrRefCount(keyPtr); - if (valuePtr == NULL) { + if (result != TCL_OK || valuePtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing return option \"-code\"", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); @@ -407,17 +407,17 @@ TclDefaultBgErrorHandlerObjCmd( TclNewLiteralStringObj(keyPtr, "-errorcode"); Tcl_IncrRefCount(keyPtr); - Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); + result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); Tcl_DecrRefCount(keyPtr); - if (valuePtr) { + if (result == TCL_OK && valuePtr != NULL) { Tcl_SetObjErrorCode(interp, valuePtr); } TclNewLiteralStringObj(keyPtr, "-errorinfo"); Tcl_IncrRefCount(keyPtr); - Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); + result = Tcl_DictObjGet(NULL, objv[2], keyPtr, &valuePtr); Tcl_DecrRefCount(keyPtr); - if (valuePtr) { + if (result == TCL_OK && valuePtr != NULL) { Tcl_AppendObjToErrorInfo(interp, valuePtr); } |