From 9886e872ee794371f0cc614b5d54105534e612ee Mon Sep 17 00:00:00 2001 From: Olivier Biot Date: Wed, 14 Aug 2024 16:40:47 +0800 Subject: [PATCH] fix a regression when no parameters are passed to the pool get method --- packages/melonjs/src/math/color.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/melonjs/src/math/color.ts b/packages/melonjs/src/math/color.ts index 8500b6e58..40c7f4061 100644 --- a/packages/melonjs/src/math/color.ts +++ b/packages/melonjs/src/math/color.ts @@ -718,10 +718,14 @@ export const colorPool = createPool< return { instance: color, reset(r, g, b, alpha) { - if (typeof r === "number") { - color.setColor(r, g, b, alpha); + if (arguments.length === 0) { + color.setColor(); } else { - color.copy(r as Color | string); + if (typeof r === "number") { + color.setColor(r, g, b, alpha); + } else { + color.copy(r as Color | string); + } } }, };