If there was an error, it will set sAD_Identity_Ref to NULL. Do you need to check for NULL here?