Commit 42e8a344 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: don't use G_IS_FILE() and g_file_get_path() on a NULL GFile

when registering the plug-in's translation domain. A NULL path is
allowed and used by script-fu.
parent b33c3086
...@@ -199,7 +199,10 @@ gimp_plug_in_register (GimpPlugIn *plug_in, ...@@ -199,7 +199,10 @@ gimp_plug_in_register (GimpPlugIn *plug_in,
if (plug_in->priv->translation_domain_name) if (plug_in->priv->translation_domain_name)
{ {
gchar *path = g_file_get_path (plug_in->priv->translation_domain_path); gchar *path = NULL;
if (plug_in->priv->translation_domain_path)
path = g_file_get_path (plug_in->priv->translation_domain_path);
_gimp_plugin_domain_register (plug_in->priv->translation_domain_name, _gimp_plugin_domain_register (plug_in->priv->translation_domain_name,
path); path);
......
...@@ -226,7 +226,7 @@ gimp_plug_in_get_property (GObject *object, ...@@ -226,7 +226,7 @@ gimp_plug_in_get_property (GObject *object,
* gimp_plug_in_set_translation_domain: * gimp_plug_in_set_translation_domain:
* @plug_in: A #GimpPlugIn. * @plug_in: A #GimpPlugIn.
* @domain_name: The name of the textdomain (must be unique). * @domain_name: The name of the textdomain (must be unique).
* @domain_path: The absolute path to the compiled message catalog * @domain_path: (nullable): A #GFile pointing to the compiled message catalog
* (may be %NULL). * (may be %NULL).
* *
* Sets a textdomain for localisation for the @plug_in. * Sets a textdomain for localisation for the @plug_in.
...@@ -250,7 +250,7 @@ gimp_plug_in_set_translation_domain (GimpPlugIn *plug_in, ...@@ -250,7 +250,7 @@ gimp_plug_in_set_translation_domain (GimpPlugIn *plug_in,
{ {
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in)); g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
g_return_if_fail (domain_name != NULL); g_return_if_fail (domain_name != NULL);
g_return_if_fail (G_IS_FILE (domain_path)); g_return_if_fail (domain_path == NULL || G_IS_FILE (domain_path));
g_free (plug_in->priv->translation_domain_name); g_free (plug_in->priv->translation_domain_name);
plug_in->priv->translation_domain_name = g_strdup (domain_name); plug_in->priv->translation_domain_name = g_strdup (domain_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment