Don't segfault if reloaded document has less pages.

This commit is contained in:
Sebastian Ramacher 2011-02-17 19:45:02 +01:00
parent 1b835ed2f3
commit a1fe0f0b4b

View File

@ -2205,7 +2205,10 @@ sc_reload(Argument* argument)
gtk_adjustment_set_value(hadjustment, ha); gtk_adjustment_set_value(hadjustment, ha);
g_static_mutex_unlock(&(Zathura.Lock.pdf_obj_lock)); 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) if(path)
free(path); free(path);