From 8320d4c695919b97f845ddf6831965d21c24333a Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Sat, 27 Jan 2024 11:08:03 -0800 Subject: [PATCH] CustomConvexShape: validate arguments of the setScaledInertia() method --- .../com/jme3/bullet/collision/shapes/CustomConvexShape.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/jme3/bullet/collision/shapes/CustomConvexShape.java b/src/main/java/com/jme3/bullet/collision/shapes/CustomConvexShape.java index c477c60a..2a66dfc9 100644 --- a/src/main/java/com/jme3/bullet/collision/shapes/CustomConvexShape.java +++ b/src/main/java/com/jme3/bullet/collision/shapes/CustomConvexShape.java @@ -143,6 +143,10 @@ protected CustomConvexShape(Vector3f halfExtents) { * @param iz the desired Z-axis rotational inertia for mass=1 (>0) */ protected void setScaledInertia(float ix, float iy, float iz) { + Validate.positive(ix, "X-axis inertia"); + Validate.positive(iy, "Y-axis inertia"); + Validate.positive(iz, "Z-axis inertia"); + inertia.set(ix, iy, iz); long shapeId = nativeId();