Handle out-of-bounds parameters in gtk_assistant_get_nth_page

Better do what the docs say...fix by Tadej Borovšak, bug 610141.
This commit is contained in:
Matthias Clasen 2010-02-23 11:23:10 -05:00
parent ddcc305f4e
commit 06d02578f8

View File

@ -1615,10 +1615,14 @@ gtk_assistant_get_nth_page (GtkAssistant *assistant,
GList *elem; GList *elem;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL); g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), NULL);
g_return_val_if_fail (page_num >= -1, NULL);
priv = assistant->priv; 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) if (!elem)
return NULL; return NULL;