forked from qt-creator/qt-creator
VcsManager: Fix crash when input directory is /
If the input directory in VcsManager::findVersionControlForDirectory is just "/", that slash gets chopped off by absoluteWithNoTrailingSlash, and the resulting string is empty. So we need to handle that case. Change-Id: I7970043a16e587c803e94c16b71bea481ea21c09 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -209,8 +209,10 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const FilePath &inpu
|
|||||||
// Make sure we an absolute path:
|
// Make sure we an absolute path:
|
||||||
QString directory = absoluteWithNoTrailingSlash(inputDirectory.toString());
|
QString directory = absoluteWithNoTrailingSlash(inputDirectory.toString());
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
if (directory[0].isLetter() && directory.indexOf(QLatin1Char(':') + QLatin1String(TEST_PREFIX)) == 1)
|
if (!directory.isEmpty() && directory[0].isLetter()
|
||||||
|
&& directory.indexOf(QLatin1Char(':') + QLatin1String(TEST_PREFIX)) == 1) {
|
||||||
directory = directory.mid(2);
|
directory = directory.mid(2);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
auto cachedData = d->findInCache(directory);
|
auto cachedData = d->findInCache(directory);
|
||||||
if (cachedData) {
|
if (cachedData) {
|
||||||
|
Reference in New Issue
Block a user