road0001 / tweensy

Automatically exported from code.google.com/p/tweensy
1 stars 0 forks source link

TweensyPluginList.checkOut loop problem #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I just noticed something that may be a problem in the actual code.

In TweensyPluginList.checkOut you can read :

var i : int;
var len : int = list.length - 1;
var Type : Class;

for(i = 0;i < len; i++) {
    Type = list[i];
    if(item is Type) return pool.checkOut(map[Type]);
}

return pool.checkOut(map[list[len]]);

The for loop would be skipping the last item. Am I just tired or is this a 
problem?

This is in the cs3 original release, cs4 original too. Didint check others

Original issue reported on code.google.com by grill...@gmail.com on 29 Mar 2009 at 8:58

GoogleCodeExporter commented 8 years ago
TweensyPluginList.as Line 63

Original comment by grill...@gmail.com on 29 Mar 2009 at 8:59

GoogleCodeExporter commented 8 years ago
It's to reduce length loops the last item is the last fallback so this isn't an 
issue
i.e. return pool.checkOut(map[list[len]]);

Original comment by flashdyn...@gmail.com on 9 Apr 2009 at 3:57