Skip to content

Commit d7f8950

Browse files
committed
Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu phaserjs#1143)
Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu phaserjs#1143)
1 parent 01db925 commit d7f8950

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ node_modules/
1515

1616
# Build
1717
dist/
18+
/npm-debug.log

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ Version 2.1.0 - "Cairhien" - -in development-
107107
* Swapped argument order of Rectangle.containsRect (thanks @beeglebug #1095 #1125)
108108
* The Game configuration object "renderer" property was being wrongly assigned to Game.renderer instead of renderType (thanks @FedeOmoto #1127)
109109
* Fixed Group.removeBetweens default endIndex (thanks @darfux #1142)
110+
* Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
111+
* Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
110112

111113
### p2.js 0.6.0 Changes and New Features
112114

src/core/Camera.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ Phaser.Camera.prototype = {
274274
*/
275275
setBoundsToWorld: function () {
276276

277-
this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
277+
if (this.bounds)
278+
{
279+
this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
280+
}
278281

279282
},
280283

src/utils/Debug.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,12 @@ Phaser.Utils.Debug.prototype = {
267267
this.start(x, y, color);
268268
this.line('Camera (' + camera.width + ' x ' + camera.height + ')');
269269
this.line('X: ' + camera.x + ' Y: ' + camera.y);
270-
this.line('Bounds x: ' + camera.bounds.x + ' Y: ' + camera.bounds.y + ' w: ' + camera.bounds.width + ' h: ' + camera.bounds.height);
270+
271+
if (camera.bounds)
272+
{
273+
this.line('Bounds x: ' + camera.bounds.x + ' Y: ' + camera.bounds.y + ' w: ' + camera.bounds.width + ' h: ' + camera.bounds.height);
274+
}
275+
271276
this.line('View x: ' + camera.view.x + ' Y: ' + camera.view.y + ' w: ' + camera.view.width + ' h: ' + camera.view.height);
272277
this.stop();
273278

0 commit comments

Comments
 (0)