From 2d785cc20db2c7a2a162556585130762ba92a6f4 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 7 Apr 2014 16:00:19 +0200 Subject: [PATCH] Check indices before accessing the list Signed-off-by: Sebastian Ramacher --- page-widget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/page-widget.c b/page-widget.c index ae1cb19..98b983a 100644 --- a/page-widget.c +++ b/page-widget.c @@ -310,9 +310,9 @@ zathura_page_widget_set_property(GObject* object, guint prop_id, const GValue* v priv->search.current = girara_list_size(priv->search.list); } else { priv->search.current = val; - zathura_rectangle_t* rect = girara_list_nth(priv->search.list, priv->search.current); - zathura_rectangle_t rectangle = recalc_rectangle(priv->page, *rect); - if (priv->search.draw) { + if (priv->search.draw == true && val >= 0 && val < (signed) girara_list_size(priv->search.list)) { + zathura_rectangle_t* rect = girara_list_nth(priv->search.list, priv->search.current); + zathura_rectangle_t rectangle = recalc_rectangle(priv->page, *rect); redraw_rect(pageview, &rectangle); } }