aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2019-07-01 11:08:59 +1000
committerSteve Bennett <steveb@workware.net.au>2019-07-01 11:14:44 +1000
commiteb6b2dcdc6345acd09ae593469abaf76b6b6fdfe (patch)
treeee504662375fafc18697c431ec38a6893b2e918e /jim.c
parenta5a84b197a864399617b439215864f3cc7b1d6a8 (diff)
downloadjimtcl-eb6b2dcdc6345acd09ae593469abaf76b6b6fdfe.zip
jimtcl-eb6b2dcdc6345acd09ae593469abaf76b6b6fdfe.tar.gz
jimtcl-eb6b2dcdc6345acd09ae593469abaf76b6b6fdfe.tar.bz2
Jim_SubstObj: Add an assertion if ref count is zero
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/jim.c b/jim.c
index b12056f..72073e1 100644
--- a/jim.c
+++ b/jim.c
@@ -11152,7 +11152,11 @@ static ScriptObj *Jim_GetSubst(Jim_Interp *interp, Jim_Obj *objPtr, int flags)
* resObjPtrPtr. */
int Jim_SubstObj(Jim_Interp *interp, Jim_Obj *substObjPtr, Jim_Obj **resObjPtrPtr, int flags)
{
- ScriptObj *script = Jim_GetSubst(interp, substObjPtr, flags);
+ ScriptObj *script;
+
+ JimPanic((substObjPtr->refCount == 0, "Jim_SubstObj() called with zero refcount object"));
+
+ script = Jim_GetSubst(interp, substObjPtr, flags);
Jim_IncrRefCount(substObjPtr); /* Make sure it's shared. */
/* In order to preserve the internal rep, we increment the