diff options
author | David King <davidk@gnome.org> | 2016-09-13 13:21:08 +0200 |
---|---|---|
committer | David King <davidk@gnome.org> | 2016-09-13 13:21:08 +0200 |
commit | cde50ce4631030fa3c46d5b6e26d2eaa3b78508b (patch) | |
tree | f9965366c4d1ef2d51b7fcc67b4b013291d6aa06 /src | |
parent | 8b1414bbab47d7e97b9d56abde17a80d91ea0fa2 (diff) | |
download | gnome-logs-cde50ce4631030fa3c46d5b6e26d2eaa3b78508b.tar.gz |
Fix crash when the journal is empty
https://bugzilla.gnome.org/show_bug.cgi?id=770072
Diffstat (limited to 'src')
-rw-r--r-- | src/gl-window.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gl-window.c b/src/gl-window.c index 7e3b87c..7abc89e 100644 --- a/src/gl-window.c +++ b/src/gl-window.c @@ -435,18 +435,23 @@ gl_window_init (GlWindow *window) toolbar = GL_EVENT_TOOLBAR (priv->event_toolbar); boot_ids = gl_event_view_get_boot_ids (event); - boot_id = &g_array_index (boot_ids, GlJournalBootID, boot_ids->len - 1); - boot_match = boot_id->boot_match; - - gl_event_toolbar_add_boots (toolbar, boot_ids); g_action_map_add_action_entries (G_ACTION_MAP (window), actions, G_N_ELEMENTS (actions), window); - action_view_boot = g_action_map_lookup_action (G_ACTION_MAP (window), - "view-boot"); - variant = g_variant_new_string (boot_match); - g_action_change_state (action_view_boot, variant); + gl_event_toolbar_add_boots (toolbar, boot_ids); + + if (boot_ids->len > 0) + { + boot_id = &g_array_index (boot_ids, GlJournalBootID, + boot_ids->len - 1); + boot_match = boot_id->boot_match; + + action_view_boot = g_action_map_lookup_action (G_ACTION_MAP (window), + "view-boot"); + variant = g_variant_new_string (boot_match); + g_action_change_state (action_view_boot, variant); + } provider = gtk_css_provider_new (); g_signal_connect (provider, "parsing-error", |