diff options
author | Kouhei Sutou <kou@cozmixng.org> | 2008-09-21 16:33:33 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2008-09-21 16:33:33 +0200 |
commit | 41d1edddcf84ca23c0fc39c5f4f3a49e408a9f1a (patch) | |
tree | d8d4f6387df12c013ed336d63ccec2bb8898dd5a /glib | |
parent | fe26075353226be9a02c8cf1a6a29586de15ce86 (diff) |
[glib-demo] Fix a crash in forms demo
Diffstat (limited to 'glib')
-rw-r--r-- | glib/demo/forms.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/glib/demo/forms.c b/glib/demo/forms.c index e5eed276..e4b1fd8c 100644 --- a/glib/demo/forms.c +++ b/glib/demo/forms.c @@ -208,11 +208,13 @@ pgd_form_field_view_set_field (GtkWidget *field_view, pgd_form_field_view_add_choice_items (GTK_TABLE (table), field, &selected, &row); - item = poppler_form_field_choice_get_item (field, selected); - text = g_strdup_printf ("%d (%s)", selected, item); - g_free (item); - pgd_table_add_property (GTK_TABLE (table), "<b>Selected item:</b>", text, &row); - g_free (text); + if (poppler_form_field_choice_get_n_items (field) > selected) { + item = poppler_form_field_choice_get_item (field, selected); + text = g_strdup_printf ("%d (%s)", selected, item); + g_free (item); + pgd_table_add_property (GTK_TABLE (table), "<b>Selected item:</b>", text, &row); + g_free (text); + } text = poppler_form_field_choice_get_text (field); pgd_table_add_property (GTK_TABLE (table), "<b>Contents:</b>", text, &row); |