From 53ccc8128b46b65f2fb8a0975716d639485e001f Mon Sep 17 00:00:00 2001 From: CacheFlowe Date: Sun, 2 Feb 2014 10:54:48 -0700 Subject: [PATCH] Protect against NaN rotation values Throws an Error if a DisplayObject's rotation was set to NaN. Without this check, Sprite's textures could disappear silently, with no reference to the improper rotation value as the culprit. --- src/pixi/display/DisplayObject.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 938d8c5..02b2b53 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -402,6 +402,9 @@ PIXI.DisplayObject.prototype.updateTransform = function() // TODO OPTIMIZE THIS!! with dirty if(this.rotation !== this.rotationCache) { + if(isNaN(parseFloat(this.rotation))) + throw new Error('DisplayObject rotation values must be numeric.'); + this.rotationCache = this.rotation; this._sr = Math.sin(this.rotation); this._cr = Math.cos(this.rotation); @@ -534,4 +537,4 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'y', { set: function(value) { this.position.y = value; } -}); \ No newline at end of file +});