mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-27 14:34:39 +01:00
Check current page number when read from history
This commit is contained in:
parent
9243fc0511
commit
7ca0f3b20e
1 changed files with 6 additions and 0 deletions
|
@ -265,11 +265,17 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
zathura_db_get_fileinfo(zathura->database, document->file_path,
|
zathura_db_get_fileinfo(zathura->database, document->file_path,
|
||||||
&document->current_page_number, &offset, &document->scale);
|
&document->current_page_number, &offset, &document->scale);
|
||||||
|
|
||||||
if (document->scale <= FLT_EPSILON) {
|
if (document->scale <= FLT_EPSILON) {
|
||||||
girara_warning("document info: '%s' has non positive scale", document->file_path);
|
girara_warning("document info: '%s' has non positive scale", document->file_path);
|
||||||
document->scale = 1;
|
document->scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document->current_page_number == 0 || document->current_page_number > document->number_of_pages) {
|
||||||
|
girara_warning("document info: '%s' has an invalid page number", document->file_path);
|
||||||
|
document->current_page_number = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin->open_function == NULL || plugin->open_function(document) != ZATHURA_PLUGIN_ERROR_OK) {
|
if (plugin->open_function == NULL || plugin->open_function(document) != ZATHURA_PLUGIN_ERROR_OK) {
|
||||||
girara_error("could not open file\n");
|
girara_error("could not open file\n");
|
||||||
goto error_free;
|
goto error_free;
|
||||||
|
|
Loading…
Add table
Reference in a new issue