Add a NULL check to be consistent with the other g_utf8_ functions.