diff options
author | Yuri Rubinsky <chaosus89@gmail.com> | 2022-10-25 10:50:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 10:50:33 +0300 |
commit | 32997a5b9de14bd08f75f1f5d4c0a7b913338d2c (patch) | |
tree | f4399d4ea9d6adad1bdde67df78d99b6b83e44ab | |
parent | c51a42778df3239fa3e9ef23e701146675985f3c (diff) | |
parent | adec51cde87d29dd74efb6e5cd0167990de8d569 (diff) |
Merge pull request #67823 from Chaosus/fix_image_crash
-rw-r--r-- | core/io/image.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp index 3450eb7abd..16dd66fc98 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -2862,6 +2862,9 @@ void Image::_repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_s } void Image::fill(const Color &p_color) { + if (data.size() == 0) { + return; + } ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill in compressed or custom image formats."); uint8_t *dst_data_ptr = data.ptrw(); @@ -2875,6 +2878,9 @@ void Image::fill(const Color &p_color) { } void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) { + if (data.size() == 0) { + return; + } ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill rect in compressed or custom image formats."); Rect2i r = Rect2i(0, 0, width, height).intersection(p_rect.abs()); |