fix:core:segfault when no streets are loaded
authorbustersnyvel <bustersnyvel@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 27 Jul 2009 15:16:21 +0000 (15:16 +0000)
committerbustersnyvel <bustersnyvel@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 27 Jul 2009 15:16:21 +0000 (15:16 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2419 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/route.c

index e0dc43a..7f98983 100644 (file)
@@ -725,10 +725,12 @@ route_set_position(struct route *this, struct pcoord *pos)
                route_info_free(this->pos);
        this->pos=NULL;
        this->pos=route_find_nearest_street(this->vehicleprofile, this->ms, pos);
+
+       // If there is no nearest street, bail out.
+       if (!this->pos) return;
+
        this->pos->street_direction=0;
        dbg(1,"this->pos=%p\n", this->pos);
-       if (! this->pos)
-               return;
        route_info_distances(this->pos, pos->pro);
        route_path_update(this, 0, 1);
 }