Fixed a bug when the app crashed when using the searchbar in mapview