diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 947cde069..420afa885 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -146,9 +146,10 @@ get_cache_entry_object(struct cache_entry *cached) if (!cache_entry_object) return NULL; - JS_SetPrivate(smjs_ctx, cache_entry_object, cached); - JS_DefineProperties(smjs_ctx, cache_entry_object, - (JSPropertySpec *) cache_entry_props); + if (JS_FALSE != JS_SetPrivate(smjs_ctx, cache_entry_object, cached) + && JS_FALSE != JS_DefineProperties(smjs_ctx, cache_entry_object, + (JSPropertySpec *) cache_entry_props)) + return cache_entry_object; - return cache_entry_object; + return NULL; }