mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix crash trying to destroy an ImageTexture object containing a null texture
The problem happened when `ImageTexture::create_from_image` was called
with an empty image. In this situation an RID was allocated despite the
texture being null. The destructor would then crash trying to acess this
null texture.
Fixes #46274
(cherry picked from commit 46218d8c37)
This commit is contained in:
committed by
Rémi Verschelde
parent
b82d5688b9
commit
138d5121eb
@@ -196,7 +196,7 @@ void ImageTexture::create(int p_width, int p_height, Image::Format p_format, uin
|
||||
}
|
||||
void ImageTexture::create_from_image(const Ref<Image> &p_image, uint32_t p_flags) {
|
||||
|
||||
ERR_FAIL_COND(p_image.is_null());
|
||||
ERR_FAIL_COND_MSG(p_image.is_null() || p_image->empty(), "Invalid image");
|
||||
flags = p_flags;
|
||||
w = p_image->get_width();
|
||||
h = p_image->get_height();
|
||||
|
||||
Reference in New Issue
Block a user