summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-08-11 21:25:03 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-08-11 21:25:03 +0000
commitb98a86310246a4bb56a7d668b0b3f2174f1b5562 (patch)
treedfa9e86e5f766ecefff2f72f4e3ce124fbf565f9 /navit
parentef8c53c096fc851dbd19ef82a78c9f658a731fbc (diff)
downloadnavit-svn-b98a86310246a4bb56a7d668b0b3f2174f1b5562.tar.gz
Fix:gui/gtk:POI search: Don't crash if no vehicle is active.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5860 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
index 656dc40c..1a5d12c7 100644
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ b/navit/gui/gtk/gui_gtk_poi.c
@@ -141,19 +141,16 @@ model_poi (struct gtk_poi_search *search)
struct item *item;
struct point p;//Cursor position in screen
struct attr attr, vehicle_attr;
- struct vehicle *v;
+ struct vehicle *v=NULL;
enum item_type selected;
//distance in meters
dist=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
- //Searches if vehicle has coord_geo to show distance from vehicle.
- //If vehicle hasn't coord_geo show distance from center of screen
- navit_get_attr(search->nav,attr_vehicle, &vehicle_attr,NULL);
- v=vehicle_attr.u.vehicle;
-
- vehicle_get_attr(v,attr_position_coord_geo, &attr, NULL);
- if (attr.u.coord_geo->lng==0.0f && attr.u.coord_geo->lat==0.0f){
+ if(navit_get_attr(search->nav,attr_vehicle, &vehicle_attr,NULL) && (v=vehicle_attr.u.vehicle)) {
+ vehicle_get_attr(v,attr_position_coord_geo, &attr, NULL);
+ }
+ if (!v || (attr.u.coord_geo->lng==0.0f && attr.u.coord_geo->lat==0.0f)){
p.x=navit_get_width(search->nav)/2;
p.y=navit_get_height(search->nav)/2;
gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from center screen (Km)"));