mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix some crashes and using null pointers
This commit is contained in:
parent
4ecc30cc5e
commit
e53e1c566a
15 changed files with 37 additions and 19 deletions
|
@ -885,8 +885,8 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
|
|||
|
||||
bool mipmap_aware = p_interpolation == INTERPOLATE_TRILINEAR /* || p_interpolation == INTERPOLATE_TRICUBIC */;
|
||||
|
||||
ERR_FAIL_COND_MSG(p_width <= 0, "Image width cannot be greater than 0.");
|
||||
ERR_FAIL_COND_MSG(p_height <= 0, "Image height cannot be greater than 0.");
|
||||
ERR_FAIL_COND_MSG(p_width <= 0, "Image width must be greater than 0.");
|
||||
ERR_FAIL_COND_MSG(p_height <= 0, "Image height must be greater than 0.");
|
||||
ERR_FAIL_COND_MSG(p_width > MAX_WIDTH, "Image width cannot be greater than " + itos(MAX_WIDTH) + ".");
|
||||
ERR_FAIL_COND_MSG(p_height > MAX_HEIGHT, "Image height cannot be greater than " + itos(MAX_HEIGHT) + ".");
|
||||
|
||||
|
@ -1322,6 +1322,8 @@ void Image::expand_x2_hq2x() {
|
|||
PoolVector<uint8_t>::Read r = data.read();
|
||||
PoolVector<uint8_t>::Write w = dest.write();
|
||||
|
||||
ERR_FAIL_COND(!r.ptr());
|
||||
|
||||
hq2x_resize((const uint32_t *)r.ptr(), width, height, (uint32_t *)w.ptr());
|
||||
}
|
||||
|
||||
|
@ -2895,6 +2897,8 @@ void Image::bumpmap_to_normalmap(float bump_scale) {
|
|||
PoolVector<uint8_t>::Read rp = data.read();
|
||||
PoolVector<uint8_t>::Write wp = result_image.write();
|
||||
|
||||
ERR_FAIL_COND(!rp.ptr());
|
||||
|
||||
unsigned char *write_ptr = wp.ptr();
|
||||
float *read_ptr = (float *)rp.ptr();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue