Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: include/v8.h

Issue 16073010: ReturnValue::Set needs to check for empty handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index e19f5861366bf3ec06e15b666e07f77740f990de..3fef9cdd80f4d6597d0a684f56a576f514ee70ae 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5665,14 +5665,22 @@ template<typename T>
template<typename S>
void ReturnValue<T>::Set(const Persistent<S>& handle) {
TYPE_CHECK(T, S);
- *value_ = *reinterpret_cast<internal::Object**>(*handle);
+ if (V8_UNLIKELY(handle.IsEmpty())) {
+ SetUndefined();
+ } else {
+ *value_ = *reinterpret_cast<internal::Object**>(*handle);
+ }
}
template<typename T>
template<typename S>
void ReturnValue<T>::Set(const Handle<S> handle) {
TYPE_CHECK(T, S);
- *value_ = *reinterpret_cast<internal::Object**>(*handle);
+ if (V8_UNLIKELY(handle.IsEmpty())) {
+ SetUndefined();
+ } else {
+ *value_ = *reinterpret_cast<internal::Object**>(*handle);
+ }
}
template<typename T>
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698