From 06d02578f81db5f1233ec76ca6441053f3e54fa3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 23 Feb 2010 11:23:10 -0500 Subject: [PATCH] Handle out-of-bounds parameters in gtk_assistant_get_nth_page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Better do what the docs say...fix by Tadej Borovšak, bug 610141. --- gtk/gtkassistant.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index daec0cfe5d..5fd6d83d3c 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -1615,10 +1615,14 @@ gtk_assistant_get_nth_page (GtkAssistant *assistant, GList *elem; g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL); + g_return_val_if_fail (page_num >= -1, NULL); priv = assistant->priv; - elem = g_list_nth (priv->pages, page_num); + if (page_num == -1) + elem = g_list_last (priv->pages); + else + elem = g_list_nth (priv->pages, page_num); if (!elem) return NULL;