]> git.proxmox.com Git - libgit2.git/commitdiff
rebase: change assertion to avoid
authorEdward Thomson <ethomson@github.com>
Thu, 26 May 2016 17:42:43 +0000 (12:42 -0500)
committerEdward Thomson <ethomson@github.com>
Wed, 1 Jun 2016 15:03:52 +0000 (10:03 -0500)
It looks like we're getting the operation and not doing anything
with it, when in fact we are asserting that it's not null.  Simply
assert that we are within the operation boundary instead of using
the `git_array_get` macro to do this for us.

src/rebase.c

index 9f3b6ec6ebcf6b7d7858150baf1dcccdb9475f79..470e62a236c49c52e8ce105a4d569bf0334ddeb0 100644 (file)
@@ -1047,15 +1047,12 @@ static int rebase_commit_inmemory(
        const char *message_encoding,
        const char *message)
 {
-       git_rebase_operation *operation;
        git_commit *commit = NULL;
        int error = 0;
 
-       operation = git_array_get(rebase->operations, rebase->current);
-
-       assert(operation);
        assert(rebase->index);
        assert(rebase->last_commit);
+       assert(rebase->current < rebase->operations.size);
 
        if ((error = rebase_commit__create(&commit, rebase, rebase->index,
                rebase->last_commit, author, committer, message_encoding, message)) < 0)