forked from qt-creator/qt-creator
QmlJS: Avoid infinite loop on empty list of import paths
Change-Id: I1b7bade71226e4181b2643cabb53f934930afc81 Reviewed-by: Marco Benelli <marco.benelli@qt.io> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -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('/')); };
|
||||
|
Reference in New Issue
Block a user