[Bf-blender-cvs] [6e87313] tmp-id-users: Add error-checking on PySequence_Fast result.

Bastien Montagne noreply at git.blender.org
Wed Jan 6 17:41:51 CET 2016


Commit: 6e873130c8ed47bf0299df77f21246d4d36aa16f
Author: Bastien Montagne
Date:   Wed Jan 6 17:41:05 2016 +0100
Branches: tmp-id-users
https://developer.blender.org/rB6e873130c8ed47bf0299df77f21246d4d36aa16f

Add error-checking on PySequence_Fast result.

===================================================================

M	source/blender/python/intern/bpy_rna_id_collection.c

===================================================================

diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index 91d584f..23a59c4 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -136,13 +136,16 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
 		return NULL;
 	}
 
-	data_cb.user_map = PyDict_New();
-
 	if (iter_id) {
 		PyObject *fast_it = PySequence_Fast(iter_id, "user_map");
+		if (fast_it == NULL) {
+			return NULL;
+		}
+
 		PyObject **ref_id = PySequence_Fast_ITEMS(fast_it);
 		Py_ssize_t iter_id_len = PySequence_Fast_GET_SIZE(fast_it);
 
+		data_cb.user_map = PyDict_New();
 		data_cb.is_subset = true;
 		for (; iter_id_len; ref_id++, iter_id_len--) {
 			PyObject *set = PySet_New(NULL);
@@ -151,7 +154,9 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
 		}
 		Py_DECREF(fast_it);
 	}
-
+	else {
+		data_cb.user_map = PyDict_New();
+	}
 
 	ListBase *lb_array[MAX_LIBARRAY];
 	int lb_index;




More information about the Bf-blender-cvs mailing list