Skip to content

Commit a7d9b2c

Browse files
committed
The P2.World.postBroadphaseHandler now checks if the returned pairs array is empty or not before processing it (thanks @wayfu phaserjs#934)
1 parent 0c88ba0 commit a7d9b2c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Version 2.1.0 - "Cairhien" - -in development-
129129
* BitmapFonts are now correctly added to the Cache._bitmapFont array and returned via Cache.getBitmapFont (thanks @prudolfs #1076)
130130
* InputHandler docs updated to avoid Pointer data-type confusion (#1097)
131131
* If you used a single Game configuration object and didn't specify the enableDebug property it would crash on Debug.preUpdate (thanks @luizbills #1053)
132+
* The P2.World.postBroadphaseHandler now checks if the returned pairs array is empty or not before processing it (thanks @wayfu #934)
132133

133134
### p2.js 0.6.0 Changes and New Features
134135

src/physics/p2/World.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ Phaser.Physics.P2.prototype = {
347347
*/
348348
postBroadphaseHandler: function (event) {
349349

350-
if (this.postBroadphaseCallback)
351-
{
352-
var i = event.pairs.length;
350+
var i = event.pairs.length;
353351

352+
if (this.postBroadphaseCallback && i > 0)
353+
{
354354
while (i -= 2)
355355
{
356356
if (event.pairs[i].parent && event.pairs[i+1].parent && !this.postBroadphaseCallback.call(this.callbackContext, event.pairs[i].parent, event.pairs[i+1].parent))

0 commit comments

Comments
 (0)