Gui: Prevent crash when trying to create ExpressionBinding without arguments

This commit is contained in:
marioalexis
2022-09-12 02:29:11 +02:00
committed by Uwe
parent 1d074847b6
commit 3a41e39de8
+4 -2
View File
@@ -53,13 +53,15 @@ void ExpressionBindingPy::init_type()
PyObject *ExpressionBindingPy::PyMake(struct _typeobject *, PyObject * args, PyObject *)
{
Py::Tuple tuple(args);
PyObject* pyObj;
if (!PyArg_ParseTuple(args,"O", &pyObj))
return nullptr;
ExpressionBinding* expr = nullptr;
PythonWrapper wrap;
wrap.loadWidgetsModule();
QWidget* obj = dynamic_cast<QWidget*>(wrap.toQObject(tuple.getItem(0)));
QWidget* obj = dynamic_cast<QWidget*>(wrap.toQObject(Py::Object(pyObj)));
if (obj) {
do {
QuantitySpinBox* sb = qobject_cast<QuantitySpinBox*>(obj);