plug-ins: fix crash when loading multi page TIFF images in non interactive mode

When loading a TIFF image using a script/plug-in in non interactive mode,
we did not initialize the list of pages, causing a crash when trying to
access it.

So, always initialize this list when non interactive.
This commit is contained in:
Jacob Boerema
2022-08-22 12:39:29 -04:00
parent ac5a6e56b7
commit 853e9d5cb4

View File

@ -345,9 +345,11 @@ load_image (GFile *file,
for (li = 0; li < pages.n_pages; li++)
pages.filtered_pages[li] = li;
if (pages.n_pages == 1)
if (pages.n_pages == 1 || run_mode != GIMP_RUN_INTERACTIVE)
{
pages.pages = g_new0 (gint, pages.n_pages);
for (li = 0; li < pages.n_pages; li++)
pages.pages[li] = li;
pages.target = GIMP_PAGE_SELECTOR_TARGET_LAYERS;
}