From a48ee6be46f22127539483bb91cf55d6dae7f3cc Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 21 Mar 2011 02:09:38 +0100 Subject: [PATCH] Fix regression from a1fe0f0b In some cases sc_reload could still segfault. This should fix it. --- zathura.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zathura.c b/zathura.c index 1b90d57..aa66cad 100644 --- a/zathura.c +++ b/zathura.c @@ -2205,10 +2205,12 @@ sc_reload(Argument* argument) gtk_adjustment_set_value(hadjustment, ha); g_static_mutex_unlock(&(Zathura.Lock.pdf_obj_lock)); - if (page >= Zathura.PDF.number_of_pages - 1) - page = Zathura.PDF.number_of_pages - 1; - Zathura.PDF.page_number = page; - draw(Zathura.PDF.page_number); + if (Zathura.PDF.number_of_pages != 0) { + if (page >= Zathura.PDF.number_of_pages - 1) + page = Zathura.PDF.number_of_pages - 1; + Zathura.PDF.page_number = page; + draw(Zathura.PDF.page_number); + } if(path) free(path);