The public APIs check for bad records and return ERROR_INVALID_HANDLE, so they will never send in a NULL rec. Something internally is sending in a NULL rec, and that needs to be fixed.
On the contrary, the record is not NULL, it has 0 parameters.
I've resent in the fix with a test showing it's correct. --Juan