]> err.no Git - mapper/commitdiff
Check that loaded position icon before using it. Change render order for position...
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 3 Sep 2007 09:43:13 +0000 (12:43 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 3 Sep 2007 09:43:13 +0000 (12:43 +0300)
src/map.c

index 53e29b957af6caa0881b61d6a2b184f5a2e0506d..280347424380e0cee0bb515bd4b4a96e9f1bb8dc 100644 (file)
--- 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;
 }