Check the node Add operator's type property before attempting to create a new node. This prevents python exceptions when calling it from the search menu, where the node type is unspecified.

Reported by Sebastian Koenig in unrelated bug report #36968.
This commit is contained in:
Lukas Toenne 2013-10-06 10:49:40 +00:00
parent 46a1d921f1
commit 96f4ee03d4

@ -113,8 +113,11 @@ class NodeAddOperator():
# Default execute simply adds a node
def execute(self, context):
self.create_node(context)
return {'FINISHED'}
if self.properties.is_property_set("type"):
self.create_node(context)
return {'FINISHED'}
else:
return {'CANCELLED'}
# Default invoke stores the mouse position to place the node correctly
# and optionally invokes the transform operator