From: dooglus Date: Mon, 14 Jan 2008 09:36:32 +0000 (+0000) Subject: Check that a ValueNode is compatible with the given type before attempting to create it. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6c43a07ee05693991ae3e8cee86cbf95b49df844;p=synfig.git Check that a ValueNode is compatible with the given type before attempting to create it. git-svn-id: http://svn.voria.com/code@1355 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/valuenode.cpp b/synfig-core/trunk/src/synfig/valuenode.cpp index 81a9fa2..2539e5b 100644 --- a/synfig-core/trunk/src/synfig/valuenode.cpp +++ b/synfig-core/trunk/src/synfig/valuenode.cpp @@ -201,6 +201,13 @@ LinkableValueNode::create(const String &name, const ValueBase& x) { if(!book().count(name)) return 0; + + if (!check_type(name, x.get_type())) + { + error(_("Bad type: ValueNode '%s' doesn't accept type '%s'"), book()[name].local_name.c_str(), ValueBase::type_local_name(x.get_type()).c_str()); + return 0; + } + return book()[name].factory(x); }