diff --git a/refs.c b/refs.c index 8c989ffec7..a0c5078901 100644 --- a/refs.c +++ b/refs.c @@ -1587,6 +1587,9 @@ struct ref_store *get_submodule_ref_store(const char *submodule) char *to_free = NULL; size_t len; + if (!submodule) + return NULL; + if (submodule) { len = strlen(submodule); while (len && is_dir_sep(submodule[len - 1])) @@ -1595,14 +1598,6 @@ struct ref_store *get_submodule_ref_store(const char *submodule) return NULL; } - if (!submodule || !*submodule) { - /* - * FIXME: This case is ideally not allowed. But that - * can't happen until we clean up all the callers. - */ - return get_main_ref_store(); - } - if (submodule[len]) /* We need to strip off one or more trailing slashes */ submodule = to_free = xmemdupz(submodule, len);