Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index 477d3b2bb03653093eecf465525ffc77e50499ed..e77c9c0876c098545de7ee4430d0a3414f05c86f 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -1609,6 +1609,9 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { |
+ if (port_id == ILLEGAL_PORT) { |
+ return false; |
+ } |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
@@ -1622,6 +1625,11 @@ DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { |
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { |
+ if (port_id == ILLEGAL_PORT) { |
zra
2015/04/04 05:03:47
Should this go after grabbing the current isolate
Cutch
2015/04/05 19:06:09
Done.
|
+ return Api::NewError("%s: illegal port_id %" Pd64 ".", |
+ CURRENT_FUNC, |
+ port_id); |
+ } |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
CHECK_CALLBACK_STATE(isolate); |