[Bf-blender-cvs] [ea6bffc] depsgraph_refactor: Adding some protection to add_operation_relation() to avoid crashing when an invalid node is encountered

Joshua Leung noreply at git.blender.org
Wed Dec 17 04:41:23 CET 2014


Commit: ea6bffcf8d4170de7dfde581187f14a09f46f9b9
Author: Joshua Leung
Date:   Wed Dec 17 00:45:54 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rBea6bffcf8d4170de7dfde581187f14a09f46f9b9

Adding some protection to add_operation_relation() to avoid crashing when an invalid node is encountered

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

M	source/blender/depsgraph/intern/depsgraph_build.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 51524d9..47d20cb 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -380,7 +380,15 @@ DepsNode *DepsgraphRelationBuilder::find_node(const RNAPathKey &key) const
 void DepsgraphRelationBuilder::add_operation_relation(OperationDepsNode *node_from, OperationDepsNode *node_to,
                                                       eDepsRelation_Type type, const string &description)
 {
-	m_graph->add_new_relation(node_from, node_to, type, description);
+	if (node_from && node_to) {
+		m_graph->add_new_relation(node_from, node_to, type, description);
+	}
+	else {
+		fprintf(stderr, "add_operation_relation(%p = %s, %p = %s, %d, %s) Failed\n",
+		        node_from, (node_from) ? node_from->identifier().c_str() : "<None>",
+		        node_to,   (node_to)   ? node_to->identifier().c_str() : "<None>",
+		        type, description.c_str());
+	}
 }
 
 /* -------------------------------------------------- */




More information about the Bf-blender-cvs mailing list