mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 08:13:55 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user