summaryrefslogtreecommitdiffstats
path: root/libpyside/pysideproperty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpyside/pysideproperty.cpp')
-rw-r--r--libpyside/pysideproperty.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/libpyside/pysideproperty.cpp b/libpyside/pysideproperty.cpp
index 839e55f..4e9b724 100644
--- a/libpyside/pysideproperty.cpp
+++ b/libpyside/pysideproperty.cpp
@@ -168,14 +168,14 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return 0;
}
- if (pData->constant && (pData->fset || pData->notify)) {
- free(pData);
- PyErr_SetString(PyExc_AttributeError, "A constant property cannot have a WRITE method or a NOTIFY signal.");
- return 0;
-
- }
pData->typeName = PySide::Signal::getTypeName(type);
- return 1;
+
+ if (!pData->typeName)
+ PyErr_SetString(PyExc_TypeError, "Invalid property type or type name.");
+ else if (pData->constant && (pData->fset || pData->notify))
+ PyErr_SetString(PyExc_TypeError, "A constant property cannot have a WRITE method or a NOTIFY signal.");
+
+ return PyErr_Occurred() ? -1 : 1;
}
void qpropertyFree(void *self)