From a82c65692ca23574af90da03a3e32eb6193871fa Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 30 Jul 2015 08:23:43 +0200 Subject: [PATCH] Fix accessor for field 0 ("prototype") fixes #9778 --- lib/base/object.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/base/object.cpp b/lib/base/object.cpp index f5eb66acb..165c6ccd3 100644 --- a/lib/base/object.cpp +++ b/lib/base/object.cpp @@ -76,13 +76,19 @@ void Object::InflateMutex(void) m_Mutex.Inflate(); } -void Object::SetField(int, const Value&) +void Object::SetField(int id, const Value&) { - BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); + if (id == 0) + BOOST_THROW_EXCEPTION(std::runtime_error("Prototype field cannot be set.")); + else + BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); } -Value Object::GetField(int) const +Value Object::GetField(int id) const { - BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); + if (id == 0) + return Empty; + else + BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID.")); }