ignore: there must be a repository

Otherwise we'll NULL-dereference in git_attr_cache__init
This commit is contained in:
Etienne Samson 2016-12-26 14:47:55 +01:00
parent a6d833a29e
commit 8a349bf2a1

View File

@ -278,7 +278,7 @@ int git_ignore__for_path(
int error = 0;
const char *workdir = git_repository_workdir(repo);
assert(ignores && path);
assert(repo && ignores && path);
memset(ignores, 0, sizeof(*ignores));
ignores->repo = repo;
@ -503,9 +503,9 @@ int git_ignore_path_is_ignored(
unsigned int i;
git_attr_file *file;
assert(ignored && pathname);
assert(repo && ignored && pathname);
workdir = repo ? git_repository_workdir(repo) : NULL;
workdir = git_repository_workdir(repo);
memset(&path, 0, sizeof(path));
memset(&ignores, 0, sizeof(ignores));