Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-05-11 14:58:15 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-05-11 14:58:15 +0300
commitaff1cfc013b7f1736d1a773b8382969f6fb8a2f5 (patch)
tree719f31e4f750ceec90cc3096a8417790931510ac /source/blender/makesrna/intern/rna_object.c
parentbc4be56608afecd446d975e7cf95c5e01cb41093 (diff)
Fix for potential NULL pointer access when looking up strands data from
caches. The 'find' function was returning a bool value, but this does not guarantee non-null pointers. Removed the return value to avoid confusion, now callers should simply check the returned pointers.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index b038950449c..80b6ea562e1 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1548,7 +1548,8 @@ Strands *rna_DupliObject_strands_new(DupliObject *dob, ReportList *UNUSED(report
/* TODO(sergey): Consider sharing the data between viewport and
* render engine.
*/
- if (BKE_dupli_object_data_find_strands(data, psys->name, &strands, NULL)) {
+ BKE_dupli_object_data_find_strands(data, psys->name, &strands, NULL);
+ if (strands) {
strands = BKE_strands_copy(strands);
}
}
@@ -1558,7 +1559,8 @@ Strands *rna_DupliObject_strands_new(DupliObject *dob, ReportList *UNUSED(report
memset(&data, 0, sizeof(data));
if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode, true)) {
- if (BKE_dupli_object_data_find_strands(&data, psys->name, &strands, NULL))
+ BKE_dupli_object_data_find_strands(&data, psys->name, &strands, NULL);
+ if (strands)
BKE_dupli_object_data_acquire_strands(&data, strands);
}
@@ -1602,7 +1604,8 @@ StrandsChildren *rna_DupliObject_strands_children_new(DupliObject *dob, ReportLi
/* TODO(sergey): Consider sharing the data between viewport and
* render engine.
*/
- if (BKE_dupli_object_data_find_strands(data, psys->name, NULL, &strands)) {
+ BKE_dupli_object_data_find_strands(data, psys->name, NULL, &strands);
+ if (strands) {
strands = BKE_strands_children_copy(strands);
}
}
@@ -1613,14 +1616,16 @@ StrandsChildren *rna_DupliObject_strands_children_new(DupliObject *dob, ReportLi
memset(&data, 0, sizeof(data));
if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode, true)) {
Strands *parents;
- if (BKE_dupli_object_data_find_strands(&data, psys->name, &parents, &strands)) {
+ BKE_dupli_object_data_find_strands(&data, psys->name, &parents, &strands);
+ if (strands) {
BKE_dupli_object_data_acquire_strands_children(&data, strands);
/* Deform child strands to follow parent motion.
* Note that this is an optional feature for viewport/render display,
* strand motion is not applied to raw child data in caches.
*/
- BKE_strands_children_deform(strands, parents, true);
+ if (parents)
+ BKE_strands_children_deform(strands, parents, true);
}
}