Skip to content

Commit

Permalink
Fix engine crashing when renaming root node (#5)
Browse files Browse the repository at this point in the history
This resolves nodes with empty names crashing the servers on linux.
  • Loading branch information
RevoluPowered authored May 3, 2024
1 parent 4309e8e commit e33f01e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/the_mirror/util/tm_file_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,18 @@ Node *TMFileUtil::load_gltf_file_as_node(const String &p_path, const bool p_disc
}
Error err = gltf_document->append_from_file(p_path, gltf_state, 8);
if (err != Error::OK) {
ERR_PRINT("TMFileUtil: Failed to load GLTF file from disk, error: " + itos(err));
ERR_PRINT("TMFileUtil: Failed to load GLTF file from disk, error: " + itos(err) + " " + p_path);
return nullptr;
}
Node *node = gltf_document->generate_scene(gltf_state);
if (node == nullptr) {
ERR_PRINT("TMFileUtil: Failed to generate a Godot scene from GLTF data, error: " + itos(err));
ERR_PRINT("TMFileUtil: Failed to generate a Godot scene from GLTF data, error: " + itos(err) + " " + p_path);
return nullptr;
}
// Disallow importing a model with an empty root node name.
if (node->get_name() == StringName()) {
node->set_name(StringName("Model"));
ERR_PRINT("TMFileUtil: You must have a valid node name on your GLTF file, the name was empty " + p_path);
return nullptr;
}
return node;
}
Expand Down

0 comments on commit e33f01e

Please sign in to comment.