[BUGFIX] Check for string before using strlen