Commit b2640c36 by Etienne Samson

config: add asserts for non-null parameters in lock/unlock

parent de2af3c2
...@@ -1182,6 +1182,8 @@ int git_config_lock(git_transaction **out, git_config *cfg) ...@@ -1182,6 +1182,8 @@ int git_config_lock(git_transaction **out, git_config *cfg)
git_config_backend *backend; git_config_backend *backend;
backend_internal *internal; backend_internal *internal;
assert(cfg);
internal = git_vector_get(&cfg->backends, 0); internal = git_vector_get(&cfg->backends, 0);
if (!internal || !internal->backend) { if (!internal || !internal->backend) {
giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends"); giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");
...@@ -1200,6 +1202,8 @@ int git_config_unlock(git_config *cfg, int commit) ...@@ -1200,6 +1202,8 @@ int git_config_unlock(git_config *cfg, int commit)
git_config_backend *backend; git_config_backend *backend;
backend_internal *internal; backend_internal *internal;
assert(cfg);
internal = git_vector_get(&cfg->backends, 0); internal = git_vector_get(&cfg->backends, 0);
if (!internal || !internal->backend) { if (!internal || !internal->backend) {
giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends"); giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends");
......
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