glib/demo/forms.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 41d1edddcf84ca23c0fc39c5f4f3a49e408a9f1a
Author: Kouhei Sutou <[EMAIL PROTECTED]>
Date:   Sun Sep 21 16:33:33 2008 +0200

    [glib-demo] Fix a crash in forms demo

diff --git a/glib/demo/forms.c b/glib/demo/forms.c
index e5eed27..e4b1fd8 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);
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to