Check for nil images before attempting to convert them.