mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 11:53:24 +00:00
Clean up JSON parsing code. Refs #1374.
Fix Engine.ReadJSONFile() which did throw a JS exception that was not caught. Discovered by s0600204. Expose Engine.ReadJSONFile() to the gui scripts. This was SVN commit r15959.
This commit is contained in:
@@ -76,7 +76,8 @@ CScriptVal JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
continue;
|
||||
|
||||
JS::RootedValue json(cx);
|
||||
scriptInterface->ParseJSON(modinfo.GetAsString(), &json);
|
||||
if (!scriptInterface->ParseJSON(modinfo.GetAsString(), &json))
|
||||
continue;
|
||||
|
||||
// Valid mod, add it to our structure
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json.address());
|
||||
@@ -101,7 +102,8 @@ CScriptVal JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
continue;
|
||||
|
||||
JS::RootedValue json(cx);
|
||||
scriptInterface->ParseJSON(modinfo.GetAsString(), &json);
|
||||
if (!scriptInterface->ParseJSON(modinfo.GetAsString(), &json))
|
||||
continue;
|
||||
|
||||
// Valid mod, add it to our structure
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json.address());
|
||||
|
||||
Reference in New Issue
Block a user