diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
commit | f081e76037432cb926be45e980eac201d337032c (patch) | |
tree | dd1225521c12ea21c0b0c3d51ec1ae3f8730755f /source/blender/io/stl/importer/stl_import_binary_reader.cc | |
parent | fa2084ae58a77b1201289b6bedac427f73c762d1 (diff) | |
parent | 462f99bf38648a08226b1fba423315aec2bc577b (diff) |
Merge branch 'master' into geometry-nodes-iterative-cachegeometry-nodes-rigid-body-integration
Diffstat (limited to 'source/blender/io/stl/importer/stl_import_binary_reader.cc')
-rw-r--r-- | source/blender/io/stl/importer/stl_import_binary_reader.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/io/stl/importer/stl_import_binary_reader.cc b/source/blender/io/stl/importer/stl_import_binary_reader.cc index 6eaed16160e..fb9dcea0a1d 100644 --- a/source/blender/io/stl/importer/stl_import_binary_reader.cc +++ b/source/blender/io/stl/importer/stl_import_binary_reader.cc @@ -15,6 +15,7 @@ #include "DNA_mesh_types.h" +#include "stl_import.hh" #include "stl_import_binary_reader.hh" #include "stl_import_mesh.hh" @@ -33,7 +34,11 @@ Mesh *read_stl_binary(FILE *file, Main *bmain, char *mesh_name, bool use_custom_ const int chunk_size = 1024; uint32_t num_tris = 0; fseek(file, BINARY_HEADER_SIZE, SEEK_SET); - fread(&num_tris, sizeof(uint32_t), 1, file); + if (fread(&num_tris, sizeof(uint32_t), 1, file) != 1) { + stl_import_report_error(file); + return nullptr; + } + if (num_tris == 0) { return BKE_mesh_add(bmain, mesh_name); } |