Commit 62c01654 authored by Ell's avatar Ell

libgimpcolor, app: gracefully reject empty ICC profiles

In gimp_color_profile_new_from_icc_profile() and
gimp_image_validate_icc_profile(), don't raise a critical when
encountering an empty profile, but rather reject it gracefully with
an error.

(cherry picked from commit 10f33b08)
parent 9da04d96
......@@ -177,8 +177,7 @@ gimp_image_validate_icc_profile (GimpImage *image,
GimpColorProfile *profile;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (length != 0, FALSE);
g_return_val_if_fail (data != NULL || length == 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
profile = gimp_color_profile_new_from_icc_profile (data, length, error);
......
......@@ -286,14 +286,14 @@ gimp_color_profile_new_from_icc_profile (const guint8 *data,
gsize length,
GError **error)
{
cmsHPROFILE lcms_profile;
GimpColorProfile *profile = NULL;
cmsHPROFILE lcms_profile = 0;
GimpColorProfile *profile = NULL;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (length > 0, NULL);
g_return_val_if_fail (data != NULL || length == 0, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
lcms_profile = cmsOpenProfileFromMem (data, length);
if (length > 0)
lcms_profile = cmsOpenProfileFromMem (data, length);
if (lcms_profile)
{
......
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