Commit ca220513 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlJS: Avoid infinite loop on empty list of import paths



Change-Id: I1b7bade71226e4181b2643cabb53f934930afc81
Reviewed-by: default avatarMarco Benelli <marco.benelli@qt.io>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent 8d15633a
......@@ -378,7 +378,7 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf
const ComponentVersion version = importInfo.version();
QString libraryPath = modulePath(packageName, version.toString(), importPaths);
bool importFound = importLibrary(doc, libraryPath, &import);
bool importFound = !libraryPath.isEmpty() && importLibrary(doc, libraryPath, &import);
// if there are cpp-based types for this package, use them too
if (valueOwner->cppQmlTypes().hasModule(packageName)) {
......
......@@ -232,6 +232,8 @@ QString QmlJS::modulePath(const QString &name, const QString &version,
const QStringList &importPaths)
{
Q_ASSERT(maybeModuleVersion(version));
if (importPaths.isEmpty())
return QString();
const QStringList parts = name.split(QLatin1Char('.'), QString::SkipEmptyParts);
auto mkpath = [] (const QStringList &xs) -> QString { return xs.join(QLatin1Char('/')); };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment