Merge "Meaningful error message if project has no parent in source"
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
index 02a75ae..bc8061e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/ImportProject.java
@@ -288,6 +288,11 @@
 
   private void checkPreconditions(ProgressMonitor pm) throws BadRequestException {
     pm.beginTask("Check preconditions", 1);
+    if (parent == null) {
+      throw new BadRequestException(
+          "The project has no parent in the source system. "
+              + "It can only be imported if a parent project is specified.");
+    }
     ProjectState p = projectCache.get(parent);
     if (p == null) {
       throw new BadRequestException(format(