diff options
author | Steve Bennett <steveb@workware.net.au> | 2019-07-01 11:08:59 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2019-07-01 11:14:44 +1000 |
commit | eb6b2dcdc6345acd09ae593469abaf76b6b6fdfe (patch) | |
tree | ee504662375fafc18697c431ec38a6893b2e918e /jim.c | |
parent | a5a84b197a864399617b439215864f3cc7b1d6a8 (diff) | |
download | jimtcl-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |