From 2e07e938f4ff7e0dd83d7c1e2a7b480efa966a86 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 30 May 2015 22:19:36 +0200 Subject: [PATCH] app, libgimpcolor: never return NULL in GimpColorManaged::get_color_profile() --- app/display/gimpdisplayshell.c | 3 ++- libgimpcolor/gimpcolormanaged.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 23af1f8dbf..69c0113067 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -1145,7 +1145,8 @@ gimp_display_shell_get_color_profile (GimpColorManaged *managed) if (image) return gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image)); - return NULL; + /* never return a NULL profile */ + return gimp_lcms_create_srgb_profile ();; } static void diff --git a/libgimpcolor/gimpcolormanaged.c b/libgimpcolor/gimpcolormanaged.c index 96781041b1..f73efa06ab 100644 --- a/libgimpcolor/gimpcolormanaged.c +++ b/libgimpcolor/gimpcolormanaged.c @@ -21,11 +21,13 @@ #include "config.h" -#include +#include +#include #include "gimpcolortypes.h" #include "gimpcolormanaged.h" +#include "gimplcms.h" /** @@ -132,7 +134,8 @@ gimp_color_managed_get_icc_profile (GimpColorManaged *managed, * gimp_color_managed_get_color_profile: * @managed: an object the implements the #GimpColorManaged interface * - * This function, if implemented, always returns a #GimpColorProfile. + * This function always returns a #GimpColorProfile and falls back to + * gimp_lcms_create_srgb_profile() if the method is not implemented. * * Return value: The @managed's #GimpColorProfile. * @@ -150,7 +153,8 @@ gimp_color_managed_get_color_profile (GimpColorManaged *managed) if (iface->get_color_profile) return iface->get_color_profile (managed); - return NULL; + /* never return a NULL profile */ + return gimp_lcms_create_srgb_profile (); } /**