mirror of https://github.com/GNOME/gimp.git
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:
parent
f384a0713d
commit
10f33b080b
|
@ -177,8 +177,7 @@ gimp_image_validate_icc_profile (GimpImage *image,
|
||||||
GimpColorProfile *profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
g_return_val_if_fail (data != NULL || length == 0, FALSE);
|
||||||
g_return_val_if_fail (length != 0, FALSE);
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
profile = gimp_color_profile_new_from_icc_profile (data, length, error);
|
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,
|
gsize length,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
cmsHPROFILE lcms_profile;
|
cmsHPROFILE lcms_profile = 0;
|
||||||
GimpColorProfile *profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL || length == 0, NULL);
|
||||||
g_return_val_if_fail (length > 0, NULL);
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, 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)
|
if (lcms_profile)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue