vendor/libgit2/src/parse.c in rugged-0.27.7 vs vendor/libgit2/src/parse.c in rugged-0.27.9

- old
+ new

@@ -6,16 +6,18 @@ */ #include "parse.h" int git_parse_ctx_init(git_parse_ctx *ctx, const char *content, size_t content_len) { - if (content_len) + if (content && content_len) { ctx->content = content; - else - ctx->content = NULL; + ctx->content_len = content_len; + } else { + ctx->content = ""; + ctx->content_len = 0; + } - ctx->content_len = content_len; ctx->remain = ctx->content; ctx->remain_len = ctx->content_len; ctx->line = ctx->remain; ctx->line_len = git__linenlen(ctx->line, ctx->remain_len); ctx->line_num = 1; @@ -24,9 +26,10 @@ } void git_parse_ctx_clear(git_parse_ctx *ctx) { memset(ctx, 0, sizeof(*ctx)); + ctx->content = ""; } void git_parse_advance_line(git_parse_ctx *ctx) { ctx->line += ctx->line_len;