From 2a0f322c22bae940d9ced753823c3f22eb746ed0 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Wed, 25 Jul 2012 20:02:04 +0200 Subject: [PATCH] Point#getLength: access to out of bounds index in arguments array prevented function from being optimized. --- src/basic/Point.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/Point.js b/src/basic/Point.js index 5f36e26d..9a647840 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -428,7 +428,7 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ // squared length should be returned. Hide it so it produces a bean // property called #length. var l = this.x * this.x + this.y * this.y; - return arguments[0] ? l : Math.sqrt(l); + return (arguments.length && arguments[0]) ? l : Math.sqrt(l); }, setLength: function(length) {