add condition check in Imgae::create(...)

(cherry picked from commit 63e258cc8f)
This commit is contained in:
RaphaelHunter 2018-05-05 16:46:51 +08:00 committed by Hein-Pieter van Braam
parent 41bb321962
commit 0b9f61c9a6
1 changed files with 3 additions and 0 deletions

View File

@ -1166,6 +1166,9 @@ PoolVector<uint8_t> Image::get_data() const {
void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) {
ERR_FAIL_INDEX(p_width - 1, MAX_WIDTH);
ERR_FAIL_INDEX(p_height - 1, MAX_HEIGHT);
int mm = 0; int mm = 0;
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0); int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
data.resize(size); data.resize(size);