diff options
author | Luca Rood <dev@lucarood.com> | 2016-12-12 01:10:01 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2016-12-17 04:53:08 +0300 |
commit | 2e15618f498c5a64c012f559bbb95273e729999a (patch) | |
tree | 00128e4c48c23895306e5ef563a394a1d810e35d /source | |
parent | 535298eea5fd50a19d04ddffb05060313e32826c (diff) |
Fix T50216: Missing checks caused data transfer segfault
Data transfer was not checking if the required geometry existed, thus
causing a segfault when it didn't. This adds the required checks, and
reports errors if geometry is missing.
This also replaces instances of the words "polygon" and "loop" in error
messages with "face" and "corner" respectively, to be consistent with
the rest of the existing UI.
Reviewed By: mont29
Differential Revision: http://developer.blender.org/D2410
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/data_transfer.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 839673c192b..3bc09c0173b 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1205,6 +1205,18 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_vert_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } + if ((map_vert_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any faces, " + "None of the 'Face' mappings can be used in this case"); + continue; + } if (ELEM(0, num_verts_dst, num_verts_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any vertices, cannot transfer vertex data"); @@ -1253,6 +1265,12 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_edge_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any faces, " + "None of the 'Face' mappings can be used in this case"); + continue; + } if (ELEM(0, num_edges_dst, num_edges_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any edges, cannot transfer edge data"); @@ -1312,9 +1330,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_loop_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } if (ELEM(0, num_loops_dst, num_loops_src)) { BKE_report(reports, RPT_ERROR, - "Source or destination meshes do not have any polygons, cannot transfer loop data"); + "Source or destination meshes do not have any faces, cannot transfer corner data"); continue; } @@ -1370,9 +1394,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); continue; } + if ((map_poly_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { + BKE_report(reports, RPT_ERROR, + "Source mesh doesn't have any edges, " + "None of the 'Edge' mappings can be used in this case"); + continue; + } if (ELEM(0, num_polys_dst, num_polys_src)) { BKE_report(reports, RPT_ERROR, - "Source or destination meshes do not have any polygons, cannot transfer poly data"); + "Source or destination meshes do not have any faces, cannot transfer face data"); continue; } |