Try to fix crash.

This commit is contained in:
K. S. Ernest (iFire) Lee 2024-11-22 19:25:51 -08:00
parent 00e6791620
commit 4838f255d4
2 changed files with 4 additions and 4 deletions

View File

@ -235,19 +235,20 @@ void EditorInterface::make_scene_preview(const String &p_path, Node *p_scene, in
World3D *world = memnew(World3D);
SubViewport *sub_viewport_node = memnew(SubViewport);
if (!sub_viewport_node)
if (!sub_viewport_node) {
return;
}
AABB scene_aabb;
scene_aabb = _calculate_aabb_for_scene(p_scene, scene_aabb);
EditorNode::get_singleton()->add_child(sub_viewport_node);
sub_viewport_node->set_update_mode(SubViewport::UPDATE_ALWAYS);
sub_viewport_node->set_size(Vector2i(p_preview_size, p_preview_size));
sub_viewport_node->set_transparent_background(false);
sub_viewport_node->set_world_3d(world);
EditorNode::get_singleton()->add_child(sub_viewport_node);
Ref<Environment> env = memnew(Environment);
env->set_background(Environment::BG_CLEAR_COLOR);

View File

@ -3164,7 +3164,6 @@ Error ResourceImporterScene::import(ResourceUID::ID p_source_id, const String &p
err = ResourceSaver::save(library, p_save_path + ".res", flags); //do not take over, let the changed files reload themselves
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save animation to file '" + p_save_path + ".res'.");
} else if (_scene_import_type == "PackedScene") {
ERR_FAIL_NULL_V_MSG(scene, ERR_BUG, "Scene is null after post-import processing.");
Ref<PackedScene> packer = memnew(PackedScene);
packer->pack(scene);
print_verbose("Saving scene to: " + p_save_path + ".scn");