diff --git a/source/scriptinterface/ScriptConversions.h b/source/scriptinterface/ScriptConversions.h index fda093d0c9..1814123dfd 100644 --- a/source/scriptinterface/ScriptConversions.h +++ b/source/scriptinterface/ScriptConversions.h @@ -95,17 +95,14 @@ template 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