app: bail out in gimp_blend_tool_initialize() if there is no gradient

This commit is contained in:
Michael Natterer 2011-04-03 00:32:59 +02:00
parent b1a0486bda
commit 6de9615154
1 changed files with 10 additions and 2 deletions

View File

@ -155,6 +155,7 @@ gimp_blend_tool_initialize (GimpTool *tool,
{
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;
}