Commit 07c5dc84 by Edward Thomson

Merge pull request #1994 from palistov/commit-cleanup

commit: Fix potential segfault
parents 65e726a8 be0a1a79
...@@ -276,10 +276,12 @@ GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id); ...@@ -276,10 +276,12 @@ GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id);
const char *git_commit_message(const git_commit *commit) const char *git_commit_message(const git_commit *commit)
{ {
const char *message = commit->raw_message; const char *message;
assert(commit); assert(commit);
message = commit->raw_message;
/* trim leading newlines from raw message */ /* trim leading newlines from raw message */
while (*message && *message == '\n') while (*message && *message == '\n')
++message; ++message;
......
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