1
0
forked from mirrors/0ad

Clean up FromJSProperty a little. Patch by Vladislav.

Differential Revision: https://code.wildfiregames.com/D399
This was SVN commit r19489.
This commit is contained in:
leper
2017-05-01 00:58:35 +00:00
parent c14a7a0b0b
commit 7d6bfe27ab
+3 -6
View File
@@ -95,17 +95,14 @@ template<typename T> static bool FromJSProperty(JSContext* cx, JS::HandleValue v
JS::RootedObject obj(cx, &v.toObject());
bool hasProperty;
if (!JS_HasProperty(cx, obj, name, &hasProperty))
if (!JS_HasProperty(cx, obj, name, &hasProperty) || !hasProperty)
return false;
JS::RootedValue value(cx);
if (!hasProperty || !JS_GetProperty(cx, obj, name, &value))
if (!JS_GetProperty(cx, obj, name, &value))
return false;
if (!ScriptInterface::FromJSVal(cx, value, out))
return false;
return true;
return ScriptInterface::FromJSVal(cx, value, out);
}
#endif //INCLUDED_SCRIPTCONVERSIONS