Check for commit without any parent

Also provide more logs on bad manifests

Change-Id: I704d6867512344107495d1c36d3b295580c5d310
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
index 08e9807..68e80e4 100644
--- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
+++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
@@ -128,7 +128,7 @@
     // May be related:
     // https://code.google.com/p/gerrit/issues/detail?id=2564
     // https://gerrit-review.googlesource.com/55540
-    if (commit != null) {
+    if (commit != null && commit.getParents().length > 0) {
       changeHooks.doRefUpdatedHook(new Branch.NameKey(p, refName),
                                     commit.getParent(0).getId(),
                                     commit.getId(), null);
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java
index 0309363..6f7b7d3 100644
--- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java
+++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java
@@ -331,7 +331,10 @@
           p = new Project.NameKey(projectName);
           try (Repository db = gitRepoManager.openRepository(p)) {
             hash = db.resolve(ref).getName();
-          } catch (IOException e) {
+          } catch (IOException | NullPointerException e) {
+            log.warn(ref);
+            log.warn(projectName);
+            log.warn(defaultRef);
             e.printStackTrace();
           }
         }