[Iterate each] fix negative array index call.

This commit is contained in:
Tanasart 2024-12-25 12:35:56 +07:00
parent af86d2b97e
commit dde78b78bb

View file

@ -28,20 +28,15 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
var val = getInputData(0);
var arr = outputs[0].getValue();
var itr = loop.iterated - 1;
var itr = max(0, loop.iterated - 1);
if(!is_array(arr)) return;
if(_typ == VALUE_TYPE.surface) {
if(is_instanceof(val, SurfaceAtlas))
arr[@ itr] = val.clone();
else if(surface_exists(val))
arr[@ itr] = surface_clone(val);
else
arr[@ itr] = val;
if(is(val, SurfaceAtlas)) arr[@ itr] = val.clone();
else if(surface_exists(val)) arr[@ itr] = surface_clone(val);
else arr[@ itr] = val;
} else
arr[@ itr] = val;