app: gimp_procedure_execute(): don't use a NULL plug-ins error message

return_vals[1] being present and being a string doesn't neccessarily
mean it comes from the plug-in, it might just as well be its first
return value, which gets generated and NULL-initialized by the plug-in
execution code even if the plug-in didn't actually return anything.
This commit is contained in:
Michael Natterer 2014-03-14 17:28:42 +01:00
parent cf05b69e1e
commit 60014630fa
1 changed files with 9 additions and 9 deletions

View File

@ -349,17 +349,17 @@ gimp_procedure_execute (GimpProcedure *procedure,
* from the error message that is optionally passed with
* the return values.
*/
if (error && *error == NULL)
{
if (gimp_value_array_length (return_vals) > 1 &&
if (error && *error == NULL &&
gimp_value_array_length (return_vals) > 1 &&
G_VALUE_HOLDS_STRING (gimp_value_array_index (return_vals, 1)))
{
GValue *value = gimp_value_array_index (return_vals, 1);
const gchar *message = g_value_get_string (value);
if (message)
g_set_error_literal (error, GIMP_PDB_ERROR,
GIMP_PDB_ERROR_FAILED,
g_value_get_string (value));
}
message);
}
break;