Why not quickly `return NULL;` on the negation of this condition, instead of nesting all code that does actual work? The reviewer must keep more context with nesting. (There are other places in this diff that could be changed following the same principle.)