Commit 42cae85f authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Show warning if document does not contain any pages

parent b895759e
...@@ -501,6 +501,7 @@ document_open(zathura_t* zathura, const char* path, const char* password) ...@@ -501,6 +501,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
goto error_out; goto error_out;
} }
gchar* file_uri = NULL;
zathura_error_t error = ZATHURA_ERROR_OK; zathura_error_t error = ZATHURA_ERROR_OK;
zathura_document_t* document = zathura_document_open(zathura->plugins.manager, path, password, &error); zathura_document_t* document = zathura_document_open(zathura->plugins.manager, path, password, &error);
...@@ -527,6 +528,12 @@ document_open(zathura_t* zathura, const char* path, const char* password) ...@@ -527,6 +528,12 @@ document_open(zathura_t* zathura, const char* path, const char* password)
const char* file_path = zathura_document_get_path(document); const char* file_path = zathura_document_get_path(document);
unsigned int number_of_pages = zathura_document_get_number_of_pages(document); unsigned int number_of_pages = zathura_document_get_number_of_pages(document);
if (number_of_pages == 0) {
girara_notify(zathura->ui.session, GIRARA_WARNING,
_("Document does not contain any pages"));
goto error_free;
}
/* read history file */ /* read history file */
zathura_fileinfo_t file_info = { 0, 0, 1, 0, 0, 0, 0, 0 }; zathura_fileinfo_t file_info = { 0, 0, 1, 0, 0, 0, 0, 0 };
bool known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info); bool known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info);
...@@ -592,7 +599,7 @@ document_open(zathura_t* zathura, const char* path, const char* password) ...@@ -592,7 +599,7 @@ document_open(zathura_t* zathura, const char* path, const char* password)
} }
/* install file monitor */ /* install file monitor */
gchar* file_uri = g_filename_to_uri(file_path, NULL, NULL); file_uri = g_filename_to_uri(file_path, NULL, NULL);
if (file_uri == NULL) { if (file_uri == NULL) {
goto error_free; goto error_free;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment