Skip to content
Snippets Groups Projects
Commit 51d2c831 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fix crash in include completion with non-canonical include paths

Use QFileInfo::fileName() to get the filename, since that also works
when the original path wasn't canonical.
parent d3642a54
No related branches found
No related tags found
No related merge requests found
...@@ -1119,11 +1119,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future, ...@@ -1119,11 +1119,7 @@ void CppModelManager::updateIncludesInPaths(QFutureInterface<void> &future,
const QFileInfo fileInfo = i.fileInfo(); const QFileInfo fileInfo = i.fileInfo();
const QString suffix = fileInfo.suffix(); const QString suffix = fileInfo.suffix();
if (suffix.isEmpty() || suffixes.contains(suffix)) { if (suffix.isEmpty() || suffixes.contains(suffix)) {
QString text = fileName.mid(path.length() + 1); QString text = fileInfo.fileName();
if (text.isEmpty()) {
qWarning() << Q_FUNC_INFO << "Empty filename?" << path << fileName;
continue;
}
if (fileInfo.isDir()) { if (fileInfo.isDir()) {
text += QLatin1Char('/'); text += QLatin1Char('/');
......
...@@ -41,7 +41,7 @@ namespace ProjectExplorer { ...@@ -41,7 +41,7 @@ namespace ProjectExplorer {
} }
namespace CppTools { namespace CppTools {
class AbstractEditorSupport; class AbstractEditorSupport;
class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment