Merge from 2.5 r21160 through r21285
[blender.git] / source / blender / python / intern / bpy_operator_wrap.c
index 4e5536c85520bea7a731dd8dc1365514512ad0e1..17029412f4df6f66ec252bd6b23d09ae1760ea84 100644 (file)
@@ -353,7 +353,8 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
        
        /* remove if it already exists */
        if ((ot=WM_operatortype_find(idname))) {
-               Py_XDECREF((PyObject*)ot->pyop_data);
+               if(ot->pyop_data)
+                       Py_XDECREF((PyObject*)ot->pyop_data);
                WM_operatortype_remove(idname);
        }