diff options
author | jsjtxietian <jsjtxietian@outlook.com> | 2023-10-26 12:50:39 +0800 |
---|---|---|
committer | jsjtxietian <jsjtxietian@outlook.com> | 2023-10-26 17:13:04 +0800 |
commit | 1fafca56a64fe6e303e05729bb2944e608675fc6 (patch) | |
tree | 841706212f44b2588d19f28d00fc0d41b2961d06 | |
parent | ea0ab441c836091f3ede370d88b5fe1453b7a653 (diff) | |
download | redot-engine-1fafca56a64fe6e303e05729bb2944e608675fc6.tar.gz |
Fix FastNoiseLite.get_seamless_image function will crashes with bad param
-rw-r--r-- | modules/noise/noise.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/noise/noise.cpp b/modules/noise/noise.cpp index 1115d92f58..65ef07e284 100644 --- a/modules/noise/noise.cpp +++ b/modules/noise/noise.cpp @@ -54,6 +54,9 @@ Vector<Ref<Image>> Noise::_get_seamless_image(int p_width, int p_height, int p_d Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const { Vector<Ref<Image>> images = _get_seamless_image(p_width, p_height, 1, p_invert, p_in_3d_space, p_blend_skirt, p_normalize); + if (images.size() == 0) { + return Ref<Image>(); + } return images[0]; } |