From 7ede227cf46c47375090bf9e28effde3bad801cf Mon Sep 17 00:00:00 2001 From: stacew Date: Sat, 23 Dec 2023 01:59:28 +0900 Subject: [PATCH] Fix issue with 'Bodies.circle' usage. --- src/factory/Bodies.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/factory/Bodies.js b/src/factory/Bodies.js index 2a373a1e..86d250af 100644 --- a/src/factory/Bodies.js +++ b/src/factory/Bodies.js @@ -116,6 +116,9 @@ var Vector = require('../geometry/Vector'); * @return {body} A new circle body */ Bodies.circle = function(x, y, radius, options, maxSides) { + if( radius === 0 ) + throw new Error('The radius of `Bodies.circle` must be non-zero.'); + options = options || {}; var circle = {