file-pdf-load: Fix possible uninitialised variable access
Print a message to the user if poppler returns n_pages = 0. Return to file open dialog. This way we prevent uninitialised variable access down the line.
This commit is contained in:

committed by
Mukund Sivaraman

parent
e3f939f9a1
commit
7f0e71dbf2
@ -1101,6 +1101,13 @@ load_dialog (PopplerDocument *doc,
|
||||
gtk_widget_show (selector);
|
||||
|
||||
n_pages = poppler_document_get_n_pages (doc);
|
||||
|
||||
if (n_pages <= 0)
|
||||
{
|
||||
gimp_message (_("Error getting number of pages from the given pdf file\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gimp_page_selector_set_n_pages (GIMP_PAGE_SELECTOR (selector), n_pages);
|
||||
gimp_page_selector_set_target (GIMP_PAGE_SELECTOR (selector),
|
||||
loadvals.target);
|
||||
|
Reference in New Issue
Block a user