Skip to content

Commit 94298ef

Browse files
committed
Because do/while loops are quite dangerous
1 parent ec06e79 commit 94298ef

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/gameobjects/components/AnimationState.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,8 @@ var AnimationState = new Class({
14851485
// And only do more if we're skipping frames and have time left
14861486
if (this.isPlaying && this._pendingStop === 0 && this.skipMissedFrames && this.accumulator > this.nextTick)
14871487
{
1488+
var safetyNet = 0;
1489+
14881490
do
14891491
{
14901492
if (this.forward)
@@ -1496,7 +1498,9 @@ var AnimationState = new Class({
14961498
anim.previousFrame(this);
14971499
}
14981500

1499-
} while (this.accumulator > this.nextTick);
1501+
safetyNet++;
1502+
1503+
} while (this.accumulator > this.nextTick && safetyNet < 60);
15001504
}
15011505
}
15021506
},

0 commit comments

Comments
 (0)