Fix crash when trying to set field on a value that is not an object

fixes #9779
This commit is contained in:
Gunnar Beutner 2015-07-30 08:28:07 +02:00
parent a82c65692c
commit 1634dbc6e4
1 changed files with 3 additions and 0 deletions

View File

@ -287,6 +287,9 @@ public:
static inline void SetField(const Object::Ptr& context, const String& field, const Value& value, const DebugInfo& debugInfo = DebugInfo())
{
if (!context)
BOOST_THROW_EXCEPTION(ScriptError("Cannot set field '" + field + "' on a value that is not an object.", debugInfo));
Dictionary::Ptr dict = dynamic_pointer_cast<Dictionary>(context);
if (dict) {