From: dooglus Date: Mon, 21 Jan 2008 17:02:51 +0000 (+0000) Subject: Don't accept illegal values for 'blend_method'. Use 'Composite' instead. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0d270efd0dd73dad0077a76ab0b5408510ab1151;p=synfig.git Don't accept illegal values for 'blend_method'. Use 'Composite' instead. git-svn-id: http://svn.voria.com/code@1414 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/layer_composite.cpp b/synfig-core/trunk/src/synfig/layer_composite.cpp index 24f640d..7381017 100644 --- a/synfig-core/trunk/src/synfig/layer_composite.cpp +++ b/synfig-core/trunk/src/synfig/layer_composite.cpp @@ -154,7 +154,18 @@ Layer_Composite::set_param(const String & param, const ValueBase &value) amount_=value.get(amount_); else if(param=="blend_method" && value.same_type_as(int())) - blend_method_=static_cast(value.get(int())); + { + Color::BlendMethod blend_method = static_cast(value.get(int())); + + if (blend_method < 0 || blend_method >= Color::BLEND_END) + { + warning("illegal value (%d) for blend_method - using Composite instead", blend_method); + blend_method_ = Color::BLEND_COMPOSITE; + return false; + } + + blend_method_ = blend_method; + } else return Layer::set_param(param,value); return true;