Don't we still need to check for a NULL buffer somewhere?