summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-26 10:15:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-26 10:15:44 (GMT)
commit9a1c42658beb9a46675417b8f4d5294ad8cbd66d (patch)
treea077eb5e7a9757d92149fd5bdaa372acb20c652c /generic
parent665eff0bf84eefb902865adc4f6ce46862cc5710 (diff)
downloadtcl-9a1c42658beb9a46675417b8f4d5294ad8cbd66d.zip
tcl-9a1c42658beb9a46675417b8f4d5294ad8cbd66d.tar.gz
tcl-9a1c42658beb9a46675417b8f4d5294ad8cbd66d.tar.bz2
Don't panic if Tcl_ConvertToType is called for a type that doesn't have a setFromAnyProc, create a proper error message.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclObj.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index e14c740..24b818b 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -993,7 +993,12 @@ Tcl_ConvertToType(
*/
if (typePtr->setFromAnyProc == NULL) {
- Tcl_Panic("may not convert object to type %s", typePtr->name);
+ if (interp) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't convert value to type %s", typePtr->name));
+ Tcl_SetErrorCode(interp, "TCL", "API_ABUSE", NULL);
+ }
+ return TCL_ERROR;
}
return typePtr->setFromAnyProc(interp, objPtr);