summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-16 15:51:46 +0100
committerGitHub <noreply@github.com>2020-01-16 15:51:46 +0100
commitdf1324540818124a3f342f860906abd2707adbe4 (patch)
tree9928a45b3b77b83329b8ec2984e545a20107ba8b /modules
parentcd7b51b9434cddb5f6104ee1ec9e88d1092d57af (diff)
parent92b36d47066117d6e9fbc6c6506ba89db2b2a712 (diff)
Merge pull request #35203 from timothyqiu/image-loader-null
Adds null check before using image loader
Diffstat (limited to 'modules')
-rw-r--r--modules/assimp/import_utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h
index f4505249db..c522b01727 100644
--- a/modules/assimp/import_utils.h
+++ b/modules/assimp/import_utils.h
@@ -355,11 +355,13 @@ public:
print_verbose("Open Asset Import: Loading embedded texture " + filename);
if (tex->mHeight == 0) {
if (tex->CheckFormat("png")) {
+ ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, Ref<Image>());
Ref<Image> img = Image::_png_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
state.path_to_image_cache.insert(p_path, img);
return img;
} else if (tex->CheckFormat("jpg")) {
+ ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, Ref<Image>());
Ref<Image> img = Image::_jpg_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
state.path_to_image_cache.insert(p_path, img);