From 6de9615154645fdec0af5d69051ca23011a553c1 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 3 Apr 2011 00:32:59 +0200 Subject: [PATCH] app: bail out in gimp_blend_tool_initialize() if there is no gradient --- app/tools/gimpblendtool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 858fa7659b..f1ce1c804a 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -153,8 +153,9 @@ gimp_blend_tool_initialize (GimpTool *tool, GimpDisplay *display, GError **error) { - GimpImage *image = gimp_display_get_image (display); - GimpDrawable *drawable = gimp_image_get_active_drawable (image); + GimpImage *image = gimp_display_get_image (display); + GimpDrawable *drawable = gimp_image_get_active_drawable (image); + GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) { @@ -182,6 +183,13 @@ gimp_blend_tool_initialize (GimpTool *tool, return FALSE; } + if (! gimp_context_get_gradient (GIMP_CONTEXT (options))) + { + g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, + _("No gradient available for use with this tool.")); + return FALSE; + } + return TRUE; }