From e6afd1f97393738f8149bc44f59860e3e05574ef Mon Sep 17 00:00:00 2001 From: martin-s Date: Tue, 9 Dec 2008 11:37:40 +0000 Subject: [PATCH] Fix:Core:Fix some crashes, another xinclude bugfix git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1776 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/graphics.c | 17 +++++++++++------ navit/navit/navit.c | 2 +- navit/navit/xmlconfig.c | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/navit/navit/graphics.c b/navit/navit/graphics.c index 7d1fb4f..fe756e9 100644 --- a/navit/navit/graphics.c +++ b/navit/navit/graphics.c @@ -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"); diff --git a/navit/navit/navit.c b/navit/navit/navit.c index ab938ce..e7414fa 100644 --- a/navit/navit/navit.c +++ b/navit/navit/navit.c @@ -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"); diff --git a/navit/navit/xmlconfig.c b/navit/navit/xmlconfig.c index e304660..4777bcc 100644 --- a/navit/navit/xmlconfig.c +++ b/navit/navit/xmlconfig.c @@ -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; -- 2.7.4