diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-16 21:46:07 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-16 21:49:23 +0800 |
commit | 92b36d47066117d6e9fbc6c6506ba89db2b2a712 (patch) | |
tree | c036306f191fef8653fb72ddf3e81eee00fe547b /editor/import | |
parent | bc34794840cc3b0bcfa29dd601a6b65b3a3047a8 (diff) |
Adds NULL check before using image loader
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 7de6db7add..a418915830 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1302,6 +1302,8 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b if (mimetype.findn("png") != -1) { //is a png + ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, ERR_UNAVAILABLE); + const Ref<Image> img = Image::_png_mem_loader_func(data_ptr, data_size); ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT); @@ -1316,6 +1318,8 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b if (mimetype.findn("jpeg") != -1) { //is a jpg + ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, ERR_UNAVAILABLE); + const Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size); ERR_FAIL_COND_V(img.is_null(), ERR_FILE_CORRUPT); |