Re-add error checking to -initWithURL:error:

Although libgit2 does some error checking, it also likes to assert against `NULL`. Avoid crashing by short-circuiting the `nil` or obviously invalid case.

CC @rowanj