submodule: check for NULL return of get_submodule_ref_store()
[gitweb.git] / builtin / submodule--helper.c
index a5c4a8a6941d46c78e4dc58d0df47532f0bb2b45..901632ac29844b6bf85feb37ae691120abf9fa24 100644 (file)
@@ -620,9 +620,13 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
                             displaypath);
        } else if (!(flags & OPT_CACHED)) {
                struct object_id oid;
+               struct ref_store *refs = get_submodule_ref_store(path);
 
-               if (refs_head_ref(get_submodule_ref_store(path),
-                                 handle_submodule_head_ref, &oid))
+               if (!refs) {
+                       print_status(flags, '-', path, ce_oid, displaypath);
+                       goto cleanup;
+               }
+               if (refs_head_ref(refs, handle_submodule_head_ref, &oid))
                        die(_("could not resolve HEAD ref inside the "
                              "submodule '%s'"), path);