From f39b7ae14a93bbe0c0632de567cea0bbb74bdb66 Mon Sep 17 00:00:00 2001 From: Uwe Oestermeier Date: Fri, 31 May 2019 15:32:13 +0200 Subject: [PATCH] Adding a return value in boundary condition. --- lib/scatter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/scatter.js b/lib/scatter.js index 168a6e2..0f2a1cb 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -410,7 +410,9 @@ export class AbstractScatter extends Throwable { keepOnStage(velocity, collision = 0.5) { let stagePolygon = this.containerPolygon - if (!stagePolygon) return + // UO: since keepOnStage is called in nextVelocity we need to + // ensure a return value + if (!stagePolygon) return { x: 0, y: 0} let polygon = this.polygon let bounced = this.bouncing() if (bounced) {