Fix: STL import crash when unable to open or read file

Regression from d1455c4138

Ensure we return from `importer_main` if no mesh could be loaded with
`read_stl_file` (e.g. `bpy.ops.wm.stl_import(filepath="<nope>")`)

Pull Request: https://projects.blender.org/blender/blender/pulls/129759
This commit is contained in:
Jesse Yurkovich
2024-11-04 04:38:15 +01:00
committed by Jesse Yurkovich
parent 2a32b26415
commit 60d88f46ba

View File

@@ -120,6 +120,9 @@ void importer_main(Main *bmain,
BLI_path_extension_strip(ob_name);
Mesh *mesh = read_stl_file(import_params);
if (!mesh) {
return;
}
Mesh *mesh_in_main = BKE_mesh_add(bmain, ob_name);
BKE_mesh_nomain_to_mesh(mesh, mesh_in_main, nullptr);