Thinking about it more, it might actually be better to just throw an error here.  Then users of the function wouldn't have to test for a NULL result.