From 60014630fa732365e03683bb31ac6a2b2511fe79 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 14 Mar 2014 17:28:42 +0100 Subject: [PATCH] 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. --- app/pdb/gimpprocedure.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 1b367e1b4f..7264809937 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -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 (error && *error == NULL && + gimp_value_array_length (return_vals) > 1 && + G_VALUE_HOLDS_STRING (gimp_value_array_index (return_vals, 1))) { - if (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); + GValue *value = gimp_value_array_index (return_vals, 1); + const gchar *message = g_value_get_string (value); - g_set_error_literal (error, GIMP_PDB_ERROR, - GIMP_PDB_ERROR_FAILED, - g_value_get_string (value)); - } + if (message) + g_set_error_literal (error, GIMP_PDB_ERROR, + GIMP_PDB_ERROR_FAILED, + message); } break;