From 6fb95bc6cb3a69cc5319b1bb637c866c428552ec Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Wed, 8 Feb 2012 23:33:31 +0100 Subject: [PATCH 1/2] Remove while loop --- document.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document.c b/document.c index 6c391ae..ee638b8 100644 --- a/document.c +++ b/document.c @@ -271,7 +271,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password zathura_plugin_error_t error = plugin->open_function(document); if (error != ZATHURA_PLUGIN_ERROR_OK) { - while (error == ZATHURA_PLUGIN_ERROR_INVALID_PASSWORD) { + if (error == ZATHURA_PLUGIN_ERROR_INVALID_PASSWORD) { zathura_password_dialog_info_t* password_dialog_info = malloc(sizeof(zathura_password_dialog_info_t)); if (password_dialog_info != NULL) { password_dialog_info->path = g_strdup(path); From 60523c5506df886b83d0f5799bb65cc61dc78975 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Wed, 8 Feb 2012 23:37:34 +0100 Subject: [PATCH 2/2] Fix current page number check --- document.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/document.c b/document.c index ee638b8..9b04517 100644 --- a/document.c +++ b/document.c @@ -304,9 +304,9 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password } /* check current page number */ - if (document->current_page_number < 1 || document->current_page_number > document->number_of_pages) { + if (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; + document->current_page_number = 0; } /* update statusbar */