Skip to content

Commit

Permalink
Fix for issue phaserjs#917, replaces commit dc49cfc
Browse files Browse the repository at this point in the history
Fix for issue phaserjs#917: Calling reset() on Sprite with a P2 body can result in body.data.world == null.
Calling addToWorld() would previously not check the _toRemove array, which could, if the timing were right, result in a Sprite being revived but then removed from the P2 World--the result of this being the Sprite's data would be in a mixed state causing it to appear visually but not function in the world.
  • Loading branch information
jonkelling committed Jun 17, 2014
1 parent dc49cfc commit 0b3f491
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/physics/p2/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ Phaser.Physics.P2.Body.prototype = {
{
if (this.game.physics.p2._toRemove[i] === this)
{
this.game.physics.p2._toRemove[i].splice(i, 1);
this.game.physics.p2._toRemove.splice(i, 1);
}
}
}
Expand Down

0 comments on commit 0b3f491

Please sign in to comment.