>I cannot pass null pointer to SafeHandle parameter (null pointer to pointer)

See above. *"You'll certainly have to create a `NullRepositorySafeHandle` type to cope with this constraint."*