Added if statement to text field to avoid crashes.