diff options
| author | jsjtxietian <jsjtxietian@outlook.com> | 2023-10-30 17:54:55 +0800 |
|---|---|---|
| committer | jsjtxietian <jsjtxietian@outlook.com> | 2023-10-30 18:44:44 +0800 |
| commit | ff45c0814396e9cec0830d042a985d5d45c49701 (patch) | |
| tree | 328fd54286948b6289cb93ab721fc9dd20881d76 | |
| parent | 9144457484f9d2f53990a0aac37caff1c9012e6d (diff) | |
| download | redot-engine-ff45c0814396e9cec0830d042a985d5d45c49701.tar.gz | |
Fix FastNoiseLite.get_image 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 65ef07e284..9b9fd640f4 100644 --- a/modules/noise/noise.cpp +++ b/modules/noise/noise.cpp @@ -166,6 +166,9 @@ Vector<Ref<Image>> Noise::_get_image(int p_width, int p_height, int p_depth, boo Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, bool p_normalize) const { Vector<Ref<Image>> images = _get_image(p_width, p_height, 1, p_invert, p_in_3d_space, p_normalize); + if (images.is_empty()) { + return Ref<Image>(); + } return images[0]; } |
