diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-06 14:11:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-06 14:11:44 +0100 |
commit | 61a3bfe7ffa6ae6f929ffe8a2e1c19a6df05d062 (patch) | |
tree | edd34897d71fa298fcdd82792647a157598c0f1f /core | |
parent | a195f81a6a4d6e35f01b499000062b7d4c9d1713 (diff) | |
parent | b5885c43eb479d1ea8beb71aac09b118a08cb855 (diff) |
Merge pull request #15398 from Jerome67000/fix_image_resize
Fix crash when using Image.resize() without calling Image.create() first
Diffstat (limited to 'core')
-rw-r--r-- | core/image.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/image.cpp b/core/image.cpp index 59d66fd66a..41d70e6df6 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -447,8 +447,6 @@ void Image::convert(Format p_new_format) { Image new_img(width, height, 0, p_new_format); - //int len=data.size(); - PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = new_img.data.write(); @@ -696,6 +694,11 @@ void Image::resize_to_po2(bool p_square) { void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { + if (data.size() == 0) { + ERR_EXPLAIN("Cannot resize image before creating it, use create() or create_from_data() first."); + ERR_FAIL(); + } + if (!_can_modify(format)) { ERR_EXPLAIN("Cannot resize in indexed, compressed or custom image formats."); ERR_FAIL(); |