From a1fe0f0b4bc2afedf51471cc83cb9006702f00a3 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 17 Feb 2011 19:45:02 +0100 Subject: [PATCH] Don't segfault if reloaded document has less pages. --- zathura.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zathura.c b/zathura.c index 1423125..8d79b93 100644 --- a/zathura.c +++ b/zathura.c @@ -2205,7 +2205,10 @@ sc_reload(Argument* argument) gtk_adjustment_set_value(hadjustment, ha); g_static_mutex_unlock(&(Zathura.Lock.pdf_obj_lock)); - draw(page); + 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);