diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-14 12:02:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-14 12:02:06 +0400 |
commit | e0388a881b668c3c7de8ccb942f360f85243bdbb (patch) | |
tree | 7d8cc5991eed76f97d12470f1d7a218814296347 /source/blender/bmesh | |
parent | b3f52205f20c12e88166ac4236fe5e4f26dc848b (diff) |
fix for own error with unwrap selection checking uvedit_have_selection() failed with no UV layer.
also add some safety checks for BM_ELEM_CD_GET_* macros.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/bmesh.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/bmesh_class.h | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index 60d38719ddb..f593f78bab7 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -243,6 +243,7 @@ extern "C" { #include <stdlib.h> #include <stdio.h> +#include <assert.h> #include "bmesh_class.h" diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index 824884fb4e4..4fa3a69356f 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -253,18 +253,17 @@ enum { }; /* defines */ - #define BM_ELEM_CD_GET_VOID_P(ele, offset) \ - ((void)0, (void *)((char *)(ele)->head.data + (offset))) + (assert(offset != -1), (void *)((char *)(ele)->head.data + (offset))) #define BM_ELEM_CD_SET_FLOAT(ele, offset, f) \ - { *((float *)((char *)(ele)->head.data + (offset))) = (f); } (void)0 + { assert(offset != -1); *((float *)((char *)(ele)->head.data + (offset))) = (f); } (void)0 #define BM_ELEM_CD_GET_FLOAT(ele, offset) \ - ((void)0, *((float *)((char *)(ele)->head.data + (offset)))) + (assert(offset != -1), *((float *)((char *)(ele)->head.data + (offset)))) #define BM_ELEM_CD_GET_FLOAT_AS_UCHAR(ele, offset) \ - (unsigned char)(BM_ELEM_CD_GET_FLOAT(ele, offset) * 255.0f) + (assert(offset != -1), (unsigned char)(BM_ELEM_CD_GET_FLOAT(ele, offset) * 255.0f)) /*forward declarations*/ |