From e4a0bdd8e2a185f120b0e0c703c03e00e971ddb6 Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Fri, 13 Jan 2012 14:26:26 +0100
Subject: [PATCH] vcs: better sanity checking

Change-Id: I1d3b347d291e9f5bc6a873e5c99506371749c0ef
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
---
 src/plugins/coreplugin/vcsmanager.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp
index 402b55eba17..c1ba283cf3e 100644
--- a/src/plugins/coreplugin/vcsmanager.cpp
+++ b/src/plugins/coreplugin/vcsmanager.cpp
@@ -128,7 +128,9 @@ public:
         QTC_ASSERT(QDir(dir).isAbsolute(), return);
         QTC_ASSERT(!dir.endsWith(QLatin1Char('/')), return);
         QTC_ASSERT(QDir::fromNativeSeparators(dir) == dir, return);
-        QTC_ASSERT(dir.startsWith(topLevel + QLatin1Char('/')) || topLevel == dir, return);
+        QTC_ASSERT(dir.startsWith(topLevel + QLatin1Char('/'))
+                   || topLevel == dir || topLevel.isEmpty(), return);
+        QTC_ASSERT((topLevel.isEmpty() && !vc) || (!topLevel.isEmpty() && vc), return);
 
         VcsInfo *newInfo = new VcsInfo(vc, topLevel);
         bool createdNewInfo(true);
-- 
GitLab