diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp
index 402b55eba17ebf5bc01d97a6ed7a82695cdd3dc6..c1ba283cf3ee359dee54718e1eb90a1f30a67a25 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);