diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index d57cbafb05..a0eb13da16 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -564,9 +564,9 @@ void ScriptInterface::DefineCustomObjectType(JSClass *clasp, JSNative constructo m_CustomObjectTypes[typeName] = std::move(type); } -JSObject* ScriptInterface::CreateCustomObject(const std::string & typeName) +JSObject* ScriptInterface::CreateCustomObject(const std::string& typeName) const { - std::map < std::string, CustomType > ::iterator it = m_CustomObjectTypes.find(typeName); + std::map::const_iterator it = m_CustomObjectTypes.find(typeName); if (it == m_CustomObjectTypes.end()) throw PSERROR_Scripting_TypeDoesNotExist(); diff --git a/source/scriptinterface/ScriptInterface.h b/source/scriptinterface/ScriptInterface.h index 047e96a658..d2c216816f 100644 --- a/source/scriptinterface/ScriptInterface.h +++ b/source/scriptinterface/ScriptInterface.h @@ -162,7 +162,7 @@ public: template bool CallFunctionVoid(JS::HandleValue val, const char* name, const T0& a0, const T1& a1, const T2& a2); - JSObject* CreateCustomObject(const std::string & typeName); + JSObject* CreateCustomObject(const std::string & typeName) const; void DefineCustomObjectType(JSClass *clasp, JSNative constructor, uint minArgs, JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *static_ps, JSFunctionSpec *static_fs); jsval GetGlobalObject();