[Bf-blender-cvs] [e0723829760] soc-2020-io-performance: Add null check for poly_smooth_groups array.
Ankit Meel
noreply at git.blender.org
Sat Jul 4 11:15:28 CEST 2020
Commit: e07238297605aa6b87ee84a941ca3bbba9301edc
Author: Ankit Meel
Date: Sat Jul 4 14:44:05 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBe07238297605aa6b87ee84a941ca3bbba9301edc
Add null check for poly_smooth_groups array.
===================================================================
M source/blender/io/wavefront_obj/intern/wavefront_obj_file_handler.cc
===================================================================
diff --git a/source/blender/io/wavefront_obj/intern/wavefront_obj_file_handler.cc b/source/blender/io/wavefront_obj/intern/wavefront_obj_file_handler.cc
index 0cae82f7204..1a3a1e4030a 100644
--- a/source/blender/io/wavefront_obj/intern/wavefront_obj_file_handler.cc
+++ b/source/blender/io/wavefront_obj/intern/wavefront_obj_file_handler.cc
@@ -211,7 +211,7 @@ void OBJWriter::write_smooth_group(OBJMesh &obj_mesh_data,
const int *poly_smooth_groups,
uint poly_index)
{
- if (!export_params_.export_smooth_groups) {
+ if (!export_params_.export_smooth_groups || !poly_smooth_groups) {
return;
}
if ((obj_mesh_data.get_ith_poly(poly_index).flag & ME_SMOOTH) == true) {
@@ -297,8 +297,7 @@ void OBJWriter::write_poly_elements(OBJMesh &obj_mesh_data, Span<Vector<uint>> u
{
Vector<uint> vertex_indices;
Vector<uint> normal_indices;
- int *poly_smooth_groups = nullptr;
- poly_smooth_groups = obj_mesh_data.calc_smooth_groups();
+ int *poly_smooth_groups = obj_mesh_data.calc_smooth_groups();
int last_face_smooth_group = -1;
/* -1 is used for a face having no vertex group. It could have been any _other_ negative
@@ -362,7 +361,7 @@ void OBJWriter::write_poly_elements(OBJMesh &obj_mesh_data, Span<Vector<uint>> u
}
}
- if (export_params_.export_smooth_groups && poly_smooth_groups) {
+ if (poly_smooth_groups) {
MEM_freeN(poly_smooth_groups);
}
}
More information about the Bf-blender-cvs
mailing list