app: fix "Bad interpreter" error messaging.

If I override the `program` variable, and it is not found in PATH
environment, then it is NULL and the error message is unhelpful. Make
the return value of g_find_program_in_path() into a separate variable
instead, and only override `program` in the end, when we know it is
non-NULL.

(cherry picked from commit 87a9feb6d9)
This commit is contained in:
Jehan 2018-08-19 12:21:57 +02:00
parent f1ff239d68
commit b67d7c4413
1 changed files with 7 additions and 4 deletions

View File

@ -294,16 +294,19 @@ gimp_interpreter_db_add_program (GimpInterpreterDB *db,
if (! g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
{
program = g_find_program_in_path (program);
if (! program || ! g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
gchar *prog;
prog = g_find_program_in_path (program);
if (! prog || ! g_file_test (prog, G_FILE_TEST_IS_EXECUTABLE))
{
g_message (_("Bad interpreter referenced in interpreter file %s: %s"),
gimp_file_get_utf8_name (file),
gimp_filename_to_utf8 (program));
if (program)
g_free (program);
if (prog)
g_free (prog);
return;
}
program = prog;
}
else
program = g_strdup (program);