Ticket #971: stop-navig-crashfix.diff

File stop-navig-crashfix.diff, 1.9 KB (added by sleske, 9 years ago)

Only call bookmarks_append_coord if coord!=NULL. Fixes crash when selecting "Stop Navigation".

  • navit/navit/navit.c

    diff --git a/navit/navit/navit.c b/navit/navit/navit.c
    index 18b12df..3cf33a1 100644
    a b navit_set_destination(struct navit *this_, struct pcoord *c, const char *descrip 
    14741474                this_->destination=*c;
    14751475                this_->destination_valid=1;
    14761476
    1477             dbg(1, "navit->navit_set_destination %i\n", c->x);
    1478             dbg(1, "navit->navit_set_destination %i\n", c->y);
    1479 
     1477                dbg(1, "navit->navit_set_destination %i\n", c->x);
     1478                dbg(1, "navit->navit_set_destination %i\n", c->y);
     1479                destination_file = bookmarks_get_destination_file(TRUE);
     1480                bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_destination, description, this_->recentdest_count);
     1481                g_free(destination_file);
    14801482        } else
    14811483                this_->destination_valid=0;
    1482         destination_file = bookmarks_get_destination_file(TRUE);
    1483         bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_destination, description, this_->recentdest_count);
    1484         g_free(destination_file);
    14851484        callback_list_call_attr_0(this_->attr_cbl, attr_destination);
    14861485        if (this_->route) {
    14871486                route_set_destination(this_->route, c, async);
    navit_set_destinations(struct navit *this_, struct pcoord *c, int count, const c 
    15061505        if (c && count) {
    15071506                this_->destination=c[count-1];
    15081507                this_->destination_valid=1;
     1508
     1509                destination_file = bookmarks_get_destination_file(TRUE);
     1510                bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_itinerary, description, this_->recentdest_count);
     1511                g_free(destination_file);
    15091512        } else
    15101513                this_->destination_valid=0;
    1511         destination_file = bookmarks_get_destination_file(TRUE);
    1512         bookmarks_append_coord(this_->former_destination, destination_file, c, type_former_itinerary, description, this_->recentdest_count);
    1513         g_free(destination_file);
    15141514        callback_list_call_attr_0(this_->attr_cbl, attr_destination);
    15151515        if (this_->route) {
    15161516                route_set_destinations(this_->route, c, count, async);