-
Expression error but still getting correct value
Hi,
I am getting an intermittent error (it comes and goes without me toching or playing anything) on an expression, but the value it outputs is still correct.
My code looks something like this:
mSource = thisComp.layer("Control").effect("mgJSON Source")(1); //Select a source layer
arr = thisComp.layer("distanceCalculator").text.sourceText.valueAtTime(mSource.inPoint); //Read array formatted as string
mIndex = timeToFrames(time - mSource.inPoint); //Find necessary frame
vals = arr.split(','); //Convert to actual array
vals[mIndex]; //Return value of frameAnd the error I’m getting is:
AE warning: Expression Disabled
Error at line 1 in property ‘Slider’ of layer 6 (‘preCalculations’) in comp ‘DISTANCE’.Undefined value used in expression (could be an out of range array subscript?)
I’m only getting the error if I trim (change the inPoint) of the source layer. The “vals” array has all necessary values, including the one at index “mIndex”. In fact, if I return vals[421] (or whatever the frame index is), I don’t get the error.
Is this just bad error reporting? I am wild guessing the “vals” array is missing its values at some point during After Effects’ calculations, but it comes back in time to return the right value.
Thanks