From: Kaj-Michael Lang Date: Mon, 3 Sep 2007 09:43:13 +0000 (+0300) Subject: Check that loaded position icon before using it. Change render order for position... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84a6a969e48bd32c42cc01b370554b7b31711782;p=mapper Check that loaded position icon before using it. Change render order for position icon. --- diff --git a/src/map.c b/src/map.c index 53e29b9..2803474 100644 --- a/src/map.c +++ b/src/map.c @@ -304,6 +304,8 @@ if(_show_poi) map_render_poi(); if(_show_tracks > 0) map_render_paths(); +if (_home.valid) + map_draw_position_icon(&_home); } /** @@ -538,6 +540,11 @@ gdk_draw_pixbuf(_map_pixmap, _gc[COLORABLE_POI], -1, -1, GDK_RGB_DITHER_NONE, 0, 0); } +/** + * Draw an icon on given Position. + * + * XXX: don't hardcode as home.png ! + */ void map_draw_position_icon(Position *pos) { @@ -546,8 +553,11 @@ GdkPixbuf *p; latlon2unit(pos->lat, pos->lon, x, y); p=gdk_pixbuf_new_from_file(DATADIR "/pixmaps/mapper/home.png", NULL); -map_draw_pixbuf(x,y,p); -g_object_unref(p); +if (p) { + map_draw_pixbuf(x,y,p); + g_object_unref(p); +} + } /** @@ -882,9 +892,6 @@ map_draw_mark(); if (_show_scale) map_scale_draw(event); -if (_home.valid) - map_draw_position_icon(&_home); - return TRUE; }