- cmake macro list_insert_after/list_insert_before now error when the item passed is not found in the list.

- BKE_pose_copy_data() check for target pointer is no longer valid and infact comparing against un-initialized memory in some cases.
This commit is contained in:
Campbell Barton
2012-09-13 01:52:58 +00:00
parent 4cb6d5d214
commit ab48f2108b
2 changed files with 9 additions and 9 deletions

View File

@@ -27,7 +27,10 @@ macro(list_insert_after
list_id item_check item_add
)
set(_index)
list(FIND ${list_id} "${item_check}" _index)
list(FIND "${list_id}" "${item_check}" _index)
if("${_index}" MATCHES "-1")
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
endif()
math(EXPR _index "${_index} + 1")
list(INSERT ${list_id} "${_index}" ${item_add})
unset(_index)
@@ -37,7 +40,10 @@ macro(list_insert_before
list_id item_check item_add
)
set(_index)
list(FIND ${list_id} "${item_check}" _index)
list(FIND "${list_id}" "${item_check}" _index)
if("${_index}" MATCHES "-1")
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
endif()
list(INSERT ${list_id} "${_index}" ${item_add})
unset(_index)
endmacro()