summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-10-24 21:50:21 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-25 18:18:24 +0000
commit2474a3b2d9fe987dac58813771f1fa66427e124f (patch)
tree3bb1a0c938f193bb10d50832b44b7ebfb97f349b
parent5daf07afe5b76e702d053aaca648b977ec3bb663 (diff)
downloadpdfium-2474a3b2d9fe987dac58813771f1fa66427e124f.tar.xz
Only set return value if one provided
This CL updates the javascript methods to only set the return value if the v8::Local is not empty. Change-Id: I1e0cac2d024671c3e217cb1b2292c40ed62484a4 Reviewed-on: https://pdfium-review.googlesource.com/16731 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/javascript/JS_Define.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 819cc9c25e..39346135c5 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -58,7 +58,8 @@ void JSPropGetter(const char* prop_name_string,
JSFormatErrorString(class_name_string, prop_name_string, sError));
return;
}
- info.GetReturnValue().Set(prop_value.ToV8Value());
+ if (!prop_value.ToV8Value().IsEmpty())
+ info.GetReturnValue().Set(prop_value.ToV8Value());
}
template <class C,
@@ -131,7 +132,8 @@ void JSMethod(const char* method_name_string,
JSFormatErrorString(class_name_string, method_name_string, sError));
return;
}
- info.GetReturnValue().Set(valueRes.ToV8Value());
+ if (!valueRes.ToV8Value().IsEmpty())
+ info.GetReturnValue().Set(valueRes.ToV8Value());
}
#define JS_STATIC_METHOD(method_name, class_name) \