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>
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 819cc9c..3934613 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -58,7 +58,8 @@
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 @@
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) \