Commit d1db74bf by nulltoken

status: Prevent segfaulting when determining the status of a repository

Fixes #465
parent 3286c408
...@@ -183,8 +183,9 @@ static int process_folder(struct status_st *st, const git_tree_entry *tree_entry ...@@ -183,8 +183,9 @@ static int process_folder(struct status_st *st, const git_tree_entry *tree_entry
git_object *subtree = NULL; git_object *subtree = NULL;
git_tree *pushed_tree = NULL; git_tree *pushed_tree = NULL;
int error, pushed_tree_position = 0; int error, pushed_tree_position = 0;
git_otype tree_entry_type; git_otype tree_entry_type = GIT_OBJ_BAD;
if (tree_entry != NULL) {
tree_entry_type = git_tree_entry_type(tree_entry); tree_entry_type = git_tree_entry_type(tree_entry);
switch (tree_entry_type) { switch (tree_entry_type) {
...@@ -204,6 +205,7 @@ static int process_folder(struct status_st *st, const git_tree_entry *tree_entry ...@@ -204,6 +205,7 @@ static int process_folder(struct status_st *st, const git_tree_entry *tree_entry
default: default:
error = git__throw(GIT_EINVALIDTYPE, "Unexpected tree entry type"); /* TODO: How should we deal with submodules? */ error = git__throw(GIT_EINVALIDTYPE, "Unexpected tree entry type"); /* TODO: How should we deal with submodules? */
} }
}
if (full_path != NULL && path_type == GIT_STATUS_PATH_FOLDER) if (full_path != NULL && path_type == GIT_STATUS_PATH_FOLDER)
error = alphasorted_futils_direach(full_path, GIT_PATH_MAX, dirent_cb, st); error = alphasorted_futils_direach(full_path, GIT_PATH_MAX, dirent_cb, st);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment