summaryrefslogtreecommitdiff
path: root/navit/mapset.c
diff options
context:
space:
mode:
Diffstat (limited to 'navit/mapset.c')
-rw-r--r--navit/mapset.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/navit/mapset.c b/navit/mapset.c
index 5c805cbb..1d610e0f 100644
--- a/navit/mapset.c
+++ b/navit/mapset.c
@@ -97,8 +97,8 @@ mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr
struct item *
mapset_search_get_item(struct mapset_search *this)
{
- struct item *ret;
- while (!(ret=map_search_get_item(this->ms))) {
+ struct item *ret=NULL;
+ while (!this->ms || !(ret=map_search_get_item(this->ms))) {
if (this->search_attr->type >= attr_country_all && this->search_attr->type <= attr_country_name)
break;
do {
@@ -115,6 +115,8 @@ mapset_search_get_item(struct mapset_search *this)
void
mapset_search_destroy(struct mapset_search *this)
{
- map_search_destroy(this->ms);
- g_free(this);
+ if (this) {
+ map_search_destroy(this->ms);
+ g_free(this);
+ }
}