plug-ins: crash on exporting dds with invalid number of mipmaps

Closes #15226

When you previously exported a dds with the pre-existing mipmaps,
that will be the option selected in the export dialog the next time.

If, however, that next time there were an incorrect number of mipmaps
available, the option was grayed out, but selected. Exporting then
caused a crash due to less mipmap layers being available than expected.

When writing the dds settings we need to update that setting in our
config object, so that's what we add here. Also remove updating the
local variable since that will not be used anymore in this function.
This commit is contained in:
Jacob Boerema 2025-11-05 09:28:45 -05:00
parent 96a921f4d5
commit b962bdbddd

View file

@ -519,7 +519,11 @@ write_dds (GFile *file,
{
if (! is_mipmap_chain_valid &&
mipmaps == DDS_MIPMAP_EXISTING)
mipmaps = DDS_MIPMAP_NONE;
{
g_object_set (config,
"mipmaps", "none",
NULL);
}
if (! save_dialog (image, drawable, procedure, config))
return GIMP_PDB_CANCEL;