From 73a9fda360f5af45bbb18e951757152b781b1a9e Mon Sep 17 00:00:00 2001 From: Hudd Date: Tue, 31 Mar 2015 19:57:35 +0300 Subject: icon_view_icon_in_cell_raw: Add assertion idx >= 0 Sometimes idx gets calculated to negative value. This causes bogus value to be returned, and that eventually resuls in a segfault. Add asserion to xfdesktop_icon_view_icon_in_cell_raw() to catch those errors, instead of crashing. --- src/xfdesktop-icon-view.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c index adff45c..1e7b0ae 100644 --- a/src/xfdesktop-icon-view.c +++ b/src/xfdesktop-icon-view.c @@ -3673,6 +3673,8 @@ static inline XfdesktopIcon * xfdesktop_icon_view_icon_in_cell_raw(XfdesktopIconView *icon_view, gint idx) { + g_return_val_if_fail(idx >= 0, NULL); + XfdesktopIcon *icon = icon_view->priv->grid_layout[idx]; if((gpointer)0xdeadbeef == icon) -- 2.3.4