From 8a1d22bfc1487f8a75fbd23544aa51383a067713 Mon Sep 17 00:00:00 2001 From: Steffen Wilke Date: Sat, 7 Dec 2024 23:11:41 +0100 Subject: [PATCH] Make PhysicsEngine more resilient for invalid collision types --- .../java/de/gurkenlabs/litiengine/physics/PhysicsEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litiengine/src/main/java/de/gurkenlabs/litiengine/physics/PhysicsEngine.java b/litiengine/src/main/java/de/gurkenlabs/litiengine/physics/PhysicsEngine.java index 2cc4f4c7a..104a96242 100644 --- a/litiengine/src/main/java/de/gurkenlabs/litiengine/physics/PhysicsEngine.java +++ b/litiengine/src/main/java/de/gurkenlabs/litiengine/physics/PhysicsEngine.java @@ -82,7 +82,7 @@ public void add(final ICollisionEntity entity) { * @param entity The entity that is about to be removed. */ public void remove(final ICollisionEntity entity) { - if (entity.getCollisionType() == null) { + if (entity.getCollisionType() == null || !collisionEntities.containsKey(entity.getCollisionType())) { return; }