Adding nil check to SearchController