You have to put a NULL check for the strings, otherwise the error message will cause a segfault