> > Sergei Gavrikov wrote: > > > As I could see Th_ExistsVar() does miss a test for pValue->zData > > > as Th_GetVar() does > > http://fossil-scm.org/index.html/artifact/a561c58c237b3eb43eaf55e6f9cc6a9b8a26e5d1?ln=1142-1149.
It looks like the same check is needed for Th_UnsetVar() too. # Expect {TH_ERROR: no such variable: i}, but got {i} % fossil test-th-eval 'set i 0; unset i; unset i' i Sergei Index: src/th.c ================================================================== --- src/th.c +++ src/th.c @@ -1251,10 +1251,14 @@ Th_Variable *pValue; pValue = thFindValue(interp, zVar, nVar, 0, 1, 0); if( !pValue ){ return TH_ERROR; + } + if( !pValue->zData ){ + Th_ErrorMessage(interp, "no such variable:", zVar, nVar); + return TH_ERROR; } Th_Free(interp, pValue->zData); pValue->zData = 0; if( pValue->pHash ){ Index: test/th1.test ================================================================== --- test/th1.test +++ test/th1.test @@ -147,5 +147,10 @@ ############################################################################### fossil test-th-eval "unset var" test th1-unset-2 {$RESULT eq {TH_ERROR: no such variable: var}} + +############################################################################### + +fossil test-th-eval "set var 1; unset var; unset var" +test th1-unset-3 {$RESULT eq {TH_ERROR: no such variable: var}} _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users