diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
commit | d15de6f264bc3659310c19bc402a432e2ea896e3 (patch) | |
tree | deb293154752257941ca8852de4eec167ff9d3b7 /modules/fbx/fbx_document.cpp | |
parent | b104f218410669ec81ec9ffd4d8833b8aa30a554 (diff) | |
parent | 194bdde94787227e8f53a4e3273c192ab70b03ac (diff) | |
download | redot-engine-d15de6f264bc3659310c19bc402a432e2ea896e3.tar.gz |
Merge pull request #96292 from AThousandShips/null_check_ref_fix
Cleanup of raw `nullptr` checks with `Ref`
Diffstat (limited to 'modules/fbx/fbx_document.cpp')
-rw-r--r-- | modules/fbx/fbx_document.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/fbx/fbx_document.cpp b/modules/fbx/fbx_document.cpp index 4e1a00cad6..8d4d0234da 100644 --- a/modules/fbx/fbx_document.cpp +++ b/modules/fbx/fbx_document.cpp @@ -875,7 +875,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) { const int material = int(fbx_material->typed_id); ERR_FAIL_INDEX_V(material, p_state->materials.size(), ERR_FILE_CORRUPT); Ref<Material> mat3d = p_state->materials[material]; - ERR_FAIL_NULL_V(mat3d, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(mat3d.is_null(), ERR_FILE_CORRUPT); Ref<BaseMaterial3D> base_material = mat3d; if (has_vertex_color && base_material.is_valid()) { @@ -891,7 +891,7 @@ Error FBXDocument::_parse_meshes(Ref<FBXState> p_state) { } mat = mat3d; } - ERR_FAIL_NULL_V(mat, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(mat.is_null(), ERR_FILE_CORRUPT); mat_name = mat->get_name(); } import_mesh->add_surface(primitive, array, morphs, @@ -1056,7 +1056,7 @@ GLTFImageIndex FBXDocument::_parse_image_save_image(Ref<FBXState> p_state, const } Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_path) { - ERR_FAIL_NULL_V(p_state, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_state.is_null(), ERR_INVALID_PARAMETER); const ufbx_scene *fbx_scene = p_state->scene.get(); for (int texture_i = 0; texture_i < static_cast<int>(fbx_scene->texture_files.count); texture_i++) { @@ -2118,7 +2118,6 @@ Error FBXDocument::_parse(Ref<FBXState> p_state, String p_path, Ref<FileAccess> Node *FBXDocument::generate_scene(Ref<GLTFState> p_state, float p_bake_fps, bool p_trimming, bool p_remove_immutable_tracks) { Ref<FBXState> state = p_state; ERR_FAIL_COND_V(state.is_null(), nullptr); - ERR_FAIL_NULL_V(state, nullptr); ERR_FAIL_INDEX_V(0, state->root_nodes.size(), nullptr); p_state->set_bake_fps(p_bake_fps); GLTFNodeIndex fbx_root = state->root_nodes.write[0]; @@ -2246,7 +2245,7 @@ Error FBXDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint3 Error err; Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ, &err); ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN); - ERR_FAIL_NULL_V(file, ERR_FILE_CANT_OPEN); + ERR_FAIL_COND_V(file.is_null(), ERR_FILE_CANT_OPEN); String base_path = p_base_path; if (base_path.is_empty()) { base_path = p_path.get_base_dir(); |