Index: plugins/clang/tests/test_assistants.cpp =================================================================== --- plugins/clang/tests/test_assistants.cpp +++ plugins/clang/tests/test_assistants.cpp @@ -96,7 +96,10 @@ file.open(QIODevice::WriteOnly | QIODevice::Text); file.write(fileContents.toUtf8()); file.close(); - return QUrl::fromLocalFile(file.fileName()); + // Generate and return a QUrl from the file's canonical name; this prevents + // DocumentController problems when QTemporaryDir returns a path containing + // a symlink (will likely be the case on Mac). + return QUrl::fromLocalFile(QFileInfo(file.fileName()).canonicalFilePath()); } class Testbed @@ -200,7 +203,13 @@ { Core::self()->documentController()->openDocument(url); DUChain::self()->waitForUpdate(IndexedString(url), KDevelop::TopDUContext::AllDeclarationsAndContexts); - return Core::self()->documentController()->documentForUrl(url)->textDocument(); + const auto doc = Core::self()->documentController()->documentForUrl(url); + if (doc) { + return doc->textDocument(); + } else { + qCritical() << "DocumentController:documentForUrl() returns NULL for" << url; + return nullptr; + } } IncludeBehavior m_includeBehavior;