summaryrefslogtreecommitdiff
path: root/src/js.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-03-19 11:07:51 +0100
committerportix <portix@gmx.net>2012-03-19 11:07:51 +0100
commit73e205c62de92259fd18cc0f36b294cd5b076f38 (patch)
tree6c858ba789412c5ddccc8c81e7403a29376dc228 /src/js.c
parente7471d91a0dbb48c0f33d83fa592203c8d124b14 (diff)
downloaddwb-73e205c62de92259fd18cc0f36b294cd5b076f38.zip
Call JSValueProtect only if JSValueToObject was successfull
Diffstat (limited to 'src/js.c')
-rw-r--r--src/js.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/js.c b/src/js.c
index 84b900d2..c4a45d8d 100644
--- a/src/js.c
+++ b/src/js.c
@@ -94,10 +94,10 @@ js_create_object(WebKitWebFrame *frame, const char *script) {
if (exc != NULL)
return NULL;
JSStringRelease(jsscript);
- JSValueProtect(ctx, ret);
JSObjectRef return_object = JSValueToObject(ctx, ret, &exc);
if (exc != NULL)
return NULL;
+ JSValueProtect(ctx, ret);
JSPropertyNameArrayRef array = JSObjectCopyPropertyNames(ctx, return_object);
for (int i=0; i<JSPropertyNameArrayGetCount(array); i++) {
JSStringRef prop_name = JSPropertyNameArrayGetNameAtIndex(array, i);