Bug 794634 - CRITICAL when adding layers with Dissolve mode

Fix a CRITICAL when calling gimp_layer_mode_get_format() with an
AUTO composite space and a NULL preferred format, which is valid:
it means the layer mode is composite-space agnostic (as DISSOLVE
is), and that there's no preferred format.

A NULL preferred format can occur during
gimp_operation_layer_mode_prepare() if the layer's mode node is not
yet attached anything through its "input" or "aux" pads, which is
the case during the call to gimp_layer_update_mode_node() while
constructing the layer's node in gimp_layer_get_node().
This commit is contained in:
Ell
2018-03-23 14:39:31 -04:00
parent a9c3b4c54d
commit f49e4b4263

View File

@ -1416,7 +1416,7 @@ gimp_layer_mode_get_format (GimpLayerMode mode,
/* compositing is color-space agnostic. return a format that has a fast
* conversion path to/from the preferred format.
*/
if (gimp_babl_format_get_linear (preferred_format))
if (! preferred_format || gimp_babl_format_get_linear (preferred_format))
return babl_format ("RGBA float");
else
return babl_format ("R'G'B'A float");