Adds check for searchText being undefined