Check if variable is a string before using as a string.