Fix:Core:Fix some crashes, another xinclude bugfix
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 9 Dec 2008 11:37:40 +0000 (11:37 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 9 Dec 2008 11:37:40 +0000 (11:37 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1776 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/graphics.c
navit/navit.c
navit/xmlconfig.c

index 7d1fb4f..fe756e9 100644 (file)
@@ -1024,13 +1024,16 @@ void graphics_displaylist_draw(struct graphics *gra, struct displaylist *display
        p.x=0;
        p.y=0;
        // FIXME find a better place to set the background color
-       graphics_gc_set_background(gra->gc[0], &l->color);
-       graphics_gc_set_foreground(gra->gc[0], &l->color);
-       gra->default_font = g_strdup(l->font);
+       if (l) {
+               graphics_gc_set_background(gra->gc[0], &l->color);
+               graphics_gc_set_foreground(gra->gc[0], &l->color);
+               gra->default_font = g_strdup(l->font);
+       }
        graphics_background_gc(gra, gra->gc[0]);
        gra->meth.draw_mode(gra->priv, draw_mode_begin);
        gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &p, 32767, 32767);
-       xdisplay_draw(displaylist->dl, gra, l, order+l->order_delta);
+       if (l) 
+               xdisplay_draw(displaylist->dl, gra, l, order+l->order_delta);
        if (callback)
                callback_list_call_attr_0(gra->cbl, attr_postdraw);
        gra->meth.draw_mode(gra->priv, draw_mode_end);
@@ -1084,8 +1087,10 @@ void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList
        }
 #endif
        profile(0,NULL);
-       order+=l->order_delta;
-       do_draw(displaylist, trans, mapsets, order);
+       if (l)
+               order+=l->order_delta;
+       if (mapsets)
+               do_draw(displaylist, trans, mapsets, order);
 //     profile(1,"do_draw");
        graphics_displaylist_draw(gra, displaylist, trans, l, 1);
        profile(1,"xdisplay_draw");
index ab938ce..e7414fa 100644 (file)
@@ -1795,7 +1795,7 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
                navit_vehicle_draw(this_, nv, pnt);
 
        /* Finally, if we reached our destination, stop navigation. */
-       if (route_destination_reached(this_->route)) {
+       if (this_->route && route_destination_reached(this_->route)) {
                navit_set_destination(this_, NULL, NULL);
        }
        profile(0,"return 5\n");
index e304660..4777bcc 100644 (file)
@@ -641,7 +641,7 @@ xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first)
                first=first->child;
                c+=s+1;
                len-=s+1;
-       } while (s < len && first);
+       } while (len > 0 && first);
        if (len > 0)
                return 0;
        return 1;