From 5d5969b46ca8576acf9132a30a68a8eb7a4d1e5a Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 23 Jul 2021 11:20:08 +0200 Subject: [PATCH] ProParser: Avoid the most common hard crash Whenever we try to access a non-local file we no more hard crash Qt Creator, instead we silently handle it as not found. Change-Id: I3cbc617093c2a6fcb30626e276996430bb3795e5 Reviewed-by: hjk --- src/shared/proparser/ioutils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp index 8b0aef01ed2..716b40deff0 100644 --- a/src/shared/proparser/ioutils.cpp +++ b/src/shared/proparser/ioutils.cpp @@ -60,6 +60,9 @@ IoUtils::FileType IoUtils::fileType(const QString &fileName) return fileType(fileName.mid(pos)); } + if (!QFileInfo::exists(fileName)) // FIXME make pro parser work with non-local + return FileNotFound; + Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName)); #ifdef Q_OS_WIN DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16());