Minor bugfix for freezing editor due to out of bounds frame index

This commit is contained in:
Jayant Jain 2014-03-06 01:54:09 +05:30
parent 5ec06159a6
commit db0fc82eb0

View file

@ -502,6 +502,7 @@ module.exports = Surface = class Surface extends CocoClass
# Skip some frame updates unless we're playing and not at end (or we haven't drawn much yet)
frameAdvanced = (@playing and @currentFrame < @world.totalFrames) or @totalFramesDrawn < 2
@currentFrame += @world.frameRate / @options.frameRate if frameAdvanced and @playing
@currentFrame = Math.min(@currentFrame, @world.totalFrames - 1)
newWorldFrame = Math.floor @currentFrame
worldFrameAdvanced = newWorldFrame isnt oldWorldFrame
if worldFrameAdvanced