Skip to content

Commit

Permalink
Point#getLength: access to out of bounds index in arguments array pre…
Browse files Browse the repository at this point in the history
…vented function from being optimized.
  • Loading branch information
puckey committed Jul 25, 2012
1 parent c73e8aa commit b5c3b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/basic/Point.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b5c3b7a

Please sign in to comment.