From 2d6ebc4513dfaed5cd7e495d3da3cc77ed182b66 Mon Sep 17 00:00:00 2001 From: Noeri Huisman <8823461+mrxz@users.noreply.github.com> Date: Mon, 19 Dec 2022 10:34:16 +0100 Subject: [PATCH] jme3-core: Throw IllegalArgumentException in setMaxTransitionWeight instead of assert --- .../java/com/jme3/anim/tween/action/BlendableAction.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/action/BlendableAction.java b/jme3-core/src/main/java/com/jme3/anim/tween/action/BlendableAction.java index ee9ed6470b..c9882529f9 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/action/BlendableAction.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/action/BlendableAction.java @@ -114,10 +114,13 @@ protected float getTransitionWeight() { } /** - * @param maxTransitionWeight The max transition weight. Must be >0 and <1 (default=1) + * @param maxTransitionWeight The max transition weight. Must be >=0 and <=1 (default=1) + * @throws IllegalArgumentException If maxTransitionWeight is not between 0 and 1. */ public void setMaxTransitionWeight(double maxTransitionWeight) { - assert maxTransitionWeight >= 0 && maxTransitionWeight <= 1; + if (maxTransitionWeight < 0.0 || maxTransitionWeight > 1.0) { + throw new IllegalArgumentException("maxTransitionWeight must be between 0 and 1"); + } this.maxTransitionWeight = maxTransitionWeight; }