From dc9c6f502e82105dd4c4cc5f3aca5915ed163910 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 14 May 2020 12:11:28 +0200 Subject: shiboken: Add an internal error when template instantiations are not found Happens in Qt 6 for QItemSelection. Task-number: PYSIDE-904 Change-Id: Id2463eeb046155615d3d356b3cf38b32cb5c15e5 Reviewed-by: Christian Tismer --- sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 2d3182874..28c7bf320 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -6080,7 +6080,12 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, const GeneratorCon s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = " << CPP_SELF_VAR << "->begin();\n"; s << INDENT << "for (Py_ssize_t pos = 0; pos < _i; pos++) _item++;\n"; - const AbstractMetaType *itemType = metaClass->templateBaseClassInstantiations().constFirst(); + const AbstractMetaTypeList instantiations = metaClass->templateBaseClassInstantiations(); + if (instantiations.isEmpty()) { + qFatal("shiboken: %s: Internal error, no instantiations of \"%s\" were found.", + __FUNCTION__, qPrintable(metaClass->qualifiedCppName())); + } + const AbstractMetaType *itemType = instantiations.constFirst(); s << INDENT << "return "; writeToPythonConversion(s, itemType, metaClass, QLatin1String("*_item")); -- cgit v1.2.3