Bug fix: GPS map direction markers
authorColin Clark <colin.clark@cclark.uk>
Tue, 24 Aug 2021 14:46:11 +0000 (15:46 +0100)
committerColin Clark <colin.clark@cclark.uk>
Tue, 24 Aug 2021 14:46:11 +0000 (15:46 +0100)
If an image has no GPS direction data, when the GPS map marker was
clicked to show the thumbnail, and then clicked to clear it, the image
marker was not redisplayed.

src/bar_gps.c

index fe2389d..bfcd7b3 100644 (file)
@@ -396,8 +396,11 @@ static gboolean bar_pane_gps_marker_keypress_cb(GtkWidget *widget, ClutterButton
                        g_string_free(text, TRUE);
 
                        parent_marker = clutter_actor_get_parent(label_marker);
-                       direction = clutter_actor_get_child_at_index(parent_marker, 0);
-                       clutter_actor_set_opacity(direction, 255);
+                       if (clutter_actor_get_n_children(parent_marker ) > 1 )
+                               {
+                               direction = clutter_actor_get_child_at_index(parent_marker, 0);
+                               clutter_actor_set_opacity(direction, 255);
+                               }
                        }
                /* otherwise, revert to the hidden text marker
                 */
@@ -409,8 +412,11 @@ static gboolean bar_pane_gps_marker_keypress_cb(GtkWidget *widget, ClutterButton
                        champlain_marker_set_selection_text_color(&marker_colour);
 
                        parent_marker = clutter_actor_get_parent(label_marker);
-                       direction = clutter_actor_get_child_at_index(parent_marker, 0);
-                       clutter_actor_set_opacity(direction, 0);
+                       if (clutter_actor_get_n_children(parent_marker ) > 1 )
+                               {
+                               direction = clutter_actor_get_child_at_index(parent_marker, 0);
+                               clutter_actor_set_opacity(direction, 0);
+                               }
                        }
 
                g_free(current_text);