From e0782e058b729553335cfe76f96ba556e54b7f58 Mon Sep 17 00:00:00 2001 From: Monsta Date: Mon, 5 Jan 2015 18:34:01 +0300 Subject: safer access to list element's data g_list_nth_data just returns NULL if either list or element is NULL --- shell/ev-history.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/ev-history.c b/shell/ev-history.c index 9b59014c..51ecb3fa 100644 --- a/shell/ev-history.c +++ b/shell/ev-history.c @@ -123,13 +123,9 @@ ev_history_add_link (EvHistory *history, EvLink *link) EvLink * ev_history_get_link_nth (EvHistory *history, int index) { - GList *l; - g_return_val_if_fail (EV_IS_HISTORY (history), NULL); - l = g_list_nth (history->priv->links, index); - - return EV_LINK (l->data); + return EV_LINK (g_list_nth_data (history->priv->links, index)); } int -- cgit v1.2.1