From 5692bb4c813ef13addc4478ef36669763ae132c3 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Fri, 24 Jul 2020 12:08:01 +0100 Subject: [PATCH] Ensure Bullet HeightMapShape3D data width and depth are at least 2. (cherry picked from commit 236857c92a01473724f205eaba8fe8c0f89e3576) --- modules/bullet/shape_bullet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index f46db09e4a6..58695e3ea78 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -468,6 +468,9 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { int l_width = d["width"]; int l_depth = d["depth"]; + ERR_FAIL_COND_MSG(l_width < 2, "Map width must be at least 2."); + ERR_FAIL_COND_MSG(l_depth < 2, "Map depth must be at least 2."); + // TODO This code will need adjustments if real_t is set to `double`, // because that precision is unnecessary for a heightmap and Bullet doesn't support it...