Index: mojo/dart/embedder/mojo_natives.cc |
diff --git a/mojo/dart/embedder/mojo_natives.cc b/mojo/dart/embedder/mojo_natives.cc |
index 028f57ae66bfcd8a5d7591f127af6d795d72d589..8f1e7c5559789f060f461395e625c8672944a94a 100644 |
--- a/mojo/dart/embedder/mojo_natives.cc |
+++ b/mojo/dart/embedder/mojo_natives.cc |
@@ -729,7 +729,7 @@ void MojoHandleWatcher_SendControlData(Dart_NativeArguments arguments) { |
CHECK_INTEGER_ARGUMENT(arguments, 1, &client_handle, InvalidArgument); |
Dart_Handle send_port_handle = Dart_GetNativeArgument(arguments, 2); |
- Dart_Port send_port_id = 0; |
+ Dart_Port send_port_id = ILLEGAL_PORT; |
if (!Dart_IsNull(send_port_handle)) { |
Dart_Handle result = Dart_SendPortGetId(send_port_handle, &send_port_id); |
if (Dart_IsError(result)) { |
@@ -768,7 +768,9 @@ void MojoHandleWatcher_RecvControlData(Dart_NativeArguments arguments) { |
Dart_Handle list = Dart_NewList(3); |
Dart_ListSetAt(list, 0, Dart_NewInteger(cd.handle)); |
- Dart_ListSetAt(list, 1, Dart_NewSendPort(cd.port)); |
+ if (cd.port != ILLEGAL_PORT) { |
+ Dart_ListSetAt(list, 1, Dart_NewSendPort(cd.port)); |
+ } |
Dart_ListSetAt(list, 2, Dart_NewInteger(cd.data)); |
Dart_SetReturnValue(arguments, list); |
} |