Fix:graphics_gtk:Fixed segfault when no LANG is set
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 23 Feb 2008 19:26:21 +0000 (19:26 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 23 Feb 2008 19:26:21 +0000 (19:26 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@910 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/gui/gtk/destination.c

index d7d6151..9ee52ae 100644 (file)
@@ -420,10 +420,14 @@ int destination_address(struct navit *nav)
        tracking=navit_get_tracking(nav);
        if (tracking && tracking_get_current_attr(tracking, attr_country_id, &search_attr))
                country_attr=&search_attr;
-       cs=country_search_new(country_attr, 0);
-       item=country_search_get_item(cs);
-       if (item && item_attr_get(item, attr_country_name, &country_name))
-               gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
-       country_search_destroy(cs);
+       if (country_attr) {
+               cs=country_search_new(country_attr, 0);
+               item=country_search_get_item(cs);
+               if (item && item_attr_get(item, attr_country_name, &country_name))
+                       gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
+               country_search_destroy(cs);
+       } else {
+               dbg(0,"warning: no default country found\n");
+       }
        return 0;
 }