Ticket #486: mg_errcheck.patch

File mg_errcheck.patch, 2.3 KB (added by pini, 11 years ago)
  • navit/map/mg/street.c

    diff --git a/navit/map/mg/street.c b/navit/map/mg/street.c
    index 8260dc5..b4493ec 100644
    a b street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, 
    774774        dbg(1,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item);
    775775        if (! country)
    776776                return 0;
    777         tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res);
     777        if (! tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res))
     778                return 0;
    778779        dbg(1,"res=0x%x (blk=0x%x)\n", res, res >> 12);
    779780        block_get_byindex(mr->m->file[mr->current_file], res >> 12, &mr->b);
    780781        street_get_data(street, &mr->b.p);
  • navit/map/mg/tree.c

    diff --git a/navit/map/mg/tree.c b/navit/map/mg/tree.c
    index ef542bc..27459cf 100644
    a b tree_search_hv(char *dirname, char *filename, unsigned int search_h, unsigned in 
    145145        dbg(1,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result);
    146146        sprintf(buffer, "%s/%s.h1", dirname, filename);
    147147        f_idx_h=file_create_caseinsensitive(buffer, 0);
    148         if (! f_idx_h)
     148        if ((!f_idx_h) || (!file_mmap(f_idx_h)))
    149149                return 0;
    150         file_mmap(f_idx_h);     
    151150        sprintf(buffer, "%s/%s.v1", dirname, filename);
    152151        f_idx_v=file_create_caseinsensitive(buffer, 0);
    153152        dbg(1,"%p %p\n", f_idx_h, f_idx_v);
    154         if (! f_idx_v) {
     153        if ((!f_idx_v) || (!file_mmap(f_idx_v))) {
    155154                file_destroy(f_idx_h);
    156155                return 0;
    157156        }
    158         file_mmap(f_idx_v);
    159157        if ((h=tree_search_h(f_idx_h, search_h))) {
    160158                dbg(1,"h=0x%x\n", h);
    161159                if ((v=tree_search_v(f_idx_v, h, search_v))) {
  • navit/navigation.c

    diff --git a/navit/navigation.c b/navit/navigation.c
    index 03afd5a..0d68ff7 100644
    a b navigation_itm_new(struct navigation *this_, struct item *ritem) 
    687687                ret->item=*sitem;
    688688                item_hash_insert(this_->hash, sitem, ret);
    689689                mr=map_rect_new(sitem->map, NULL);
    690                 sitem=map_rect_get_item_byid(mr, sitem->id_hi, sitem->id_lo);
     690                if (! (sitem=map_rect_get_item_byid(mr, sitem->id_hi, sitem->id_lo)))
     691                        return NULL;
    691692                if (item_attr_get(sitem, attr_street_name, &attr))
    692693                        ret->name1=map_convert_string(sitem->map,attr.u.str);
    693694                if (item_attr_get(sitem, attr_street_name_systematic, &attr))