Mercurial > geeqie
diff src/view_dir.c @ 523:0717bcc4f2b7
Handle the case of reduction of the number of view directory types.
Previously it was leading to a segfault.
author | zas_ |
---|---|
date | Fri, 25 Apr 2008 08:07:22 +0000 |
parents | fd4208f8b5f3 |
children | fe675761d091 |
line wrap: on
line diff
--- a/src/view_dir.c Thu Apr 24 20:29:09 2008 +0000 +++ b/src/view_dir.c Fri Apr 25 08:07:22 2008 +0000 @@ -58,6 +58,8 @@ ViewDir *vd_new(DirViewType type, const gchar *path) { + g_assert(VIEW_DIR_TYPES_COUNT <= G_N_ELEMENTS(menu_view_dir_radio_entries)); + ViewDir *vd = g_new0(ViewDir, 1); vd->path = NULL; @@ -618,7 +620,7 @@ submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); - for (i = 0; i < G_N_ELEMENTS(menu_view_dir_radio_entries); i++) + for (i = 0; i < VIEW_DIR_TYPES_COUNT; i++) { item = menu_item_add_check(submenu, _(menu_view_dir_radio_entries[i].label), (vd->type == menu_view_dir_radio_entries[i].value),