diff options
| author | Ben Straub <bstraub@github.com> | 2012-04-27 13:53:28 -0700 |
|---|---|---|
| committer | Ben Straub <bstraub@github.com> | 2012-05-11 11:30:46 -0700 |
| commit | 7149a6252c6124a505d377fe36054e120ee2299b (patch) | |
| tree | 5d7620c4c89cceb82f23c93b191a8bc6d8cec7ce /src/revparse.c | |
| parent | 387d01b8578ebedc665d8fa707b8897f9a04f380 (diff) | |
| download | libgit2-7149a6252c6124a505d377fe36054e120ee2299b.tar.gz | |
Returning error if dereferencing operation fails.
Diffstat (limited to 'src/revparse.c')
| -rw-r--r-- | src/revparse.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/revparse.c b/src/revparse.c index 472cc7587..7d57ad7dd 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -174,6 +174,10 @@ static int dereference_to_type(git_object **out, git_object *obj, git_otype targ /* Dereference once, if possible. */ obj2 = dereference_object(obj1); + if (!obj2) { + giterr_set(GITERR_REFERENCE, "Can't dereference to type"); + return GIT_ERROR; + } if (obj1 != obj) { git_object_free(obj1); } @@ -226,7 +230,6 @@ static int handle_caret_syntax(git_object **out, git_object *obj, const char *mo /* {...} -> Dereference until we reach an object of a certain type. */ if (dereference_to_type(out, obj, parse_obj_type(movement)) < 0) { - giterr_set(GITERR_REFERENCE, "Can't dereference to type"); return GIT_ERROR; } return 0; |
