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.
This commit is contained in:
Ell 2018-07-05 20:34:15 -04:00
parent f384a0713d
commit 10f33b080b
2 changed files with 6 additions and 7 deletions

View File

@ -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);

View File

@ -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)
{