From 84a6a969e48bd32c42cc01b370554b7b31711782 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 3 Sep 2007 12:43:13 +0300 Subject: [PATCH] Check that loaded position icon before using it. Change render order for position icon. --- src/map.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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; } -- 2.39.5