Fix #10511 ScriptFu CRITICAL on scripts with no dialog, e.g. Reverse Layers

Magic number 1 changed to 2 in one place. Missed in earlier fix for #10127.

Changed magic number to a defined macro constant so it might not happen again,
should GimpConfig change again.
This commit is contained in:
bootchk
2023-12-22 09:33:18 -05:00
parent 60f8e47176
commit 11b7e4cded
3 changed files with 13 additions and 8 deletions

View File

@ -357,7 +357,7 @@ script_fu_script_get_command_from_params (SFScript *script,
for (i = 0; i < script->n_args; i++)
{
GValue value = G_VALUE_INIT;
GParamSpec *pspec = pspecs[i + 1];
GParamSpec *pspec = pspecs[i + SF_ARG_TO_CONFIG_OFFSET];
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (config), pspec->name, &value);
@ -495,10 +495,10 @@ script_fu_script_param_init (SFScript *script,
if (script->n_args > n &&
arg->type == type &&
/* The first pspec is "procedure", the second is "run-mode". */
n_pspecs > n + 2)
n_pspecs > n + SF_ARG_TO_CONFIG_OFFSET)
{
GValue value = G_VALUE_INIT;
GParamSpec *pspec = pspecs[n + 2];
GParamSpec *pspec = pspecs[n + SF_ARG_TO_CONFIG_OFFSET];
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (config), pspec->name, &value);