Skip to content

Commit

Permalink
[Backport] Fix potential crash for unknown inner type
Browse files Browse the repository at this point in the history
- fixes #60

(cherry picked from commit MeVisLab/pythonqt@e83dbed)
  • Loading branch information
mrbean-bremen authored and jcfr committed Jan 31, 2024
1 parent 60853dc commit ab0ad43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PythonQtConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ PyObject* PythonQtConvertListOfKnownClassToPythonList(const void* /*QList<T>* */
ListType* list = (ListType*)inList;
static PythonQtClassInfo* innerType = PythonQt::priv()->getClassInfo(PythonQtMethodInfo::getInnerListTypeName(QByteArray(QMetaType::typeName(metaTypeId))));
if (innerType == nullptr) {
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type " << innerType->className().constData() << std::endl;
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type for " << QMetaType::typeName(metaTypeId) << std::endl;
}
PyObject* result = PyTuple_New(list->size());
int i = 0;
Expand All @@ -309,7 +309,7 @@ bool PythonQtConvertPythonListToListOfKnownClass(PyObject* obj, void* /*QList<T>
ListType* list = (ListType*)outList;
static PythonQtClassInfo* innerType = PythonQt::priv()->getClassInfo(PythonQtMethodInfo::getInnerListTypeName(QByteArray(QMetaType::typeName(metaTypeId))));
if (innerType == nullptr) {
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type " << innerType->className().constData() << std::endl;
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type for " << QMetaType::typeName(metaTypeId) << std::endl;
}
bool result = false;
if (PySequence_Check(obj)) {
Expand Down

0 comments on commit ab0ad43

Please sign in to comment.